Skip to content

Instantly share code, notes, and snippets.


Pedro Canterini pcanterini

View GitHub Profile
# Alot of these configs have been taken from the various places
# on the web, most from here
# Set the colours you can use
pcanterini /
Last active Aug 29, 2015
# Ask for the administrator password upfront.
sudo -v
# homebrew
ruby -e "$(curl -fsSL"
brew update
# taps
pcanterini / ubuntu-node-setup
Created May 19, 2015
Ubuntu nodejs git hook
View ubuntu-node-setup
# ubuntu server setup
adduser deploy sudo
# on your machine
# ssh-copy-id deploy@IPADDRESS
# ssh deploy@IPADDRESS -i yoursakeyfile
# edit /etc/ssh/ssh_config set PasswordAuthentication to 'no'
# run service ssh restart to restart ssh
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
NodeList.prototype.__proto__ = Array.prototype
pcanterini / DNSimpleUpdater
Last active Aug 29, 2015 — forked from digitaljhelms/DNSimpleUpdater
DNSimple DNS Updater for OS X Yosemite
View DNSimpleUpdater
AUTH_EMAIL='your@email' # dnsimple account email address
AUTH_TOKEN='your-api-token' # dnsimple api token
DOMAIN_ID='' # domain name or id
RECORD_ID='12345' # record id to update
curl -H "X-DNSimple-Token: $AUTH_EMAIL:$AUTH_TOKEN" \
-H "Accept: application/json" \
View git aliases
nuke = !git branch -D $1 && git push origin :$1 ( git nuke branch name)
pcanterini / tape.js
Created Nov 10, 2015
tape example test
View tape.js
import test from 'tape';
// For each unit test you write,
// answer these questions:
test('What component aspect are you testing?', assert => {
const actual = 'What is the actual output?';
const expected = 'What is the expected output?';
assert.equal(actual, expected,
'What should the feature do?');
pcanterini /
Created Nov 15, 2015 — forked from paulirish/
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.


Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
View gist:5498977

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
pcanterini / knife-solo
Last active Dec 21, 2015
Setting up server with knife solo
View knife-solo
# ssh stuff
brew install ssh-copy-id
ssh-copy-id root@server
# knife solo
gem install knife-solo
knife solo init project-name
knife cookbook create nginx -o cookbooks
knife prepare root@ip
# remember to add cookbook to json file eg: {"run_list":["recipe[nginx]"]}