Skip to content

Instantly share code, notes, and snippets.

@debasishg
debasishg / dod.md
Last active May 7, 2025 14:59
Data oriented design, hardware awareness, cache awareness in data structures & algorithms
@aswinsekar
aswinsekar / git.sh
Last active August 12, 2024 14:09
Git script Files
# delete local branches that no longer have remote reference
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
# delete files that are being ignored by git(.gitignore) under a directory
git clean -xdn # dry run all the files that will list all the gitignore files under the directory
git clean -xdf # to clean the files that are ignored
# to delete all the files in the git repo, execute the command in the root directory
# clone all repos of an org (requires ruby1.9+)
curl -s https://api.github.com/orgs/[ORGANIZATION]/repos | ruby -rjson -e 'JSON.load(STDIN.read).each {|repo| %x[git clone #{repo["ssh_url"]} ]}'
@theodorosploumis
theodorosploumis / Nework_throttling_profiles.md
Last active May 21, 2025 21:41
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@xeoncross
xeoncross / cr2_to_video.sh
Last active December 15, 2023 13:06
Converting a folder of .CR2 (Canon Raw Images) into a timelapse video on mac or linux
# Assuming your have installed the following:
#
# brew install ufraw imagick ffmpeg
# apt-get install ufraw imagick ffmpeg
# Convert to JPG's
for img in *.CR2; do convert -resize 1920 "$img" "$img.jpg"; print "$img"; done
# Make a video
@paulirish
paulirish / what-forces-layout.md
Last active June 20, 2025 23:33
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
/*!
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:[email protected]
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
/*
@kevincennis
kevincennis / v8.md
Last active June 7, 2025 11:22
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)
@staltz
staltz / introrx.md
Last active June 18, 2025 06:22
The introduction to Reactive Programming you've been missing
@mattlewissf
mattlewissf / add-p.md
Last active June 19, 2025 20:22
Lightning Talk: Git add -p

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
@mikeal
mikeal / gist:1840641
Created February 16, 2012 01:33
get a new/clean port with node.js
var portrange = 45032
function getPort (cb) {
var port = portrange
portrange += 1
var server = net.createServer()
server.listen(port, function (err) {
server.once('close', function () {
cb(port)