Skip to content

Instantly share code, notes, and snippets.

@dak
dak / git-pushing-multiple.rst
Created January 15, 2021 03:29 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@dak
dak / scanner.sh
Created May 12, 2020 20:18 — forked from andyrbell/scanner.sh
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@dak
dak / jspm.travis.setup.md
Created December 7, 2015 19:25 — forked from topheman/jspm.travis.setup.md
Travis setup of Github token for jspm
@dak
dak / gist:b57dbd9582901ccdce99
Created April 29, 2015 14:40
sprint:010mix trace
rake db:drop db:create db:migrate db:seed sprint:010mix --trace
** Invoke config/secrets.yml (first_time, not_needed)
** Invoke config/secrets.yml.example (first_time, not_needed)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:drop
** Invoke db:create (first_time)
** Invoke db:load_config
** Execute db:create

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.

@dak
dak / index.md
Created August 31, 2014 18:04 — forked from mathisonian/index.md

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

inspiration

My inspiration for building this was Max Ogden's Requirebin, which allows users to use a browser based editor to run custom javascript in the browser (including javascript that had require() statements that would normally need to be pre-processed using browserify).

@dak
dak / options.md
Last active August 29, 2015 14:05
Options for Linking to Numbered Elements

Objective

References to Tables, Figures, and other elements on a page should be named for that element. For example, the link to the 3rd figure on a page should read "Figure 3" (and that Figure should also be labeled as such).

Problem

The HTML webview uses to display content does not include the desired numbering scheme, nor does it include any metadata on the elements that can be used to divine the appropriate numbers.

Currently, webview uses CSS counters to label all the elements, relying on a pseudo element to to place the counter number for the element before it as a label.

For example:

@dak
dak / test-data.json
Last active August 29, 2015 14:04
test-data
[{
"id": "d3911c28",
"task": "Update site"
}, {
"id": "c192bcaf",
"task": "Call Ed"
}, {
"id": "be7790d1",
"task": "E-mail Ross"
}]
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default and default-ssl to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/