Skip to content

Instantly share code, notes, and snippets.

View pcanterini's full-sized avatar

Pedro Canterini pcanterini

View GitHub Profile
#!/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 August 29, 2015 14:20
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 15:11
Ubuntu nodejs git hook
# 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
@pcanterini
pcanterini / bling.js
Last active August 29, 2015 14:23 — forked from paulirish/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 August 29, 2015 14:25 — forked from digitaljhelms/DNSimpleUpdater
DNSimple DNS Updater for OS X Yosemite
#!/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" \
@pcanterini
pcanterini / git aliases
Created January 30, 2014 15:18
git aliases
nuke = !git branch -D $1 && git push origin :$1 ( git nuke branch name)
@pcanterini
pcanterini / tape.js
Created November 10, 2015 03:26
tape example test
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 November 15, 2015 09:12 — forked from paulirish/what-forces-layout.md
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.

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()

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 December 21, 2015 21:49
Setting up server with 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]"]}