Skip to content

Instantly share code, notes, and snippets.

Avatar

Pedro Canterini pcanterini

View GitHub Profile
View osx-for-hackers.sh
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@pcanterini
pcanterini / software.sh
Last active Aug 29, 2015
software.sh
View software.sh
#!/bin/sh
# Ask for the administrator password upfront.
sudo -v
# homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
# taps
@pcanterini
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
pcanterini / DNSimpleUpdater
Last active Aug 29, 2015 — forked from digitaljhelms/DNSimpleUpdater
DNSimple DNS Updater for OS X Yosemite
View DNSimpleUpdater
#!/bin/bash
AUTH_EMAIL='your@email' # dnsimple account email address
AUTH_TOKEN='your-api-token' # dnsimple api token
DOMAIN_ID='yourdomain.com' # domain name or id
RECORD_ID='12345' # record id to update
IP="`curl http://icanhazip.com/`"
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
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
pcanterini / what-forces-layout.md
Created Nov 15, 2015 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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.

Element

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)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@pcanterini
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]"]}