Skip to content

Instantly share code, notes, and snippets.

View pcanterini's full-sized avatar

Pedro Canterini pcanterini

View GitHub Profile
@pcanterini
pcanterini / rails-stack-script
Last active December 21, 2015 23:39
rails stack on ubuntu 12.04 LTS
- create deploy user and add to sudoers
- log in as deployer
- install stack with: sudo wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh
- install apache2:
sudo apt-get update
sudo apt-get install apache2
- fix for rvm then install passenger
rvm remove 2.0.0
rvm autolibs install openssl
rvm install ruby-2.0.0-p247 --with-openssl-dir=$HOME/.rvm/usr
@pcanterini
pcanterini / dnsimple_update.sh
Created October 12, 2013 21:22
update ip on dnsimple
#!/bin/bash
DOMAIN_ID=""
RECORD_ID=""
IP="`curl http://icanhazip.com/`"
curl -H 'X-DNSimple-Token: email:account_token' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-X PUT \
@pcanterini
pcanterini / nodejs env config
Created November 18, 2013 00:07
nodejs env config
// Load configurations
// if test env, load example file
var env = process.env.NODE_ENV || 'development'
, config = require('./config/config')[env]
, mongoose = require('mongoose')
@pcanterini
pcanterini / composition.js
Last active January 28, 2016 07:08
Composition over Inheritance in JS
// Prototypal OO with ES6
// Eric Elliott's example
let animal = {
animalType: 'animal',
describe () {
return `An ${this.animalType}, with ${this.furColor} fur,
${this.legs} legs, and a ${this.tail} tail.`;
}
@pcanterini
pcanterini / flightplan-deploy.md
Created August 11, 2016 18:23 — forked from learncodeacademy/flightplan-deploy.md
Deploy Node.js Apps with Flightplan

##Setup your server (this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g forever

##Install flightplan

  • npm install -g flightplan
  • in your project folder npm install flightplan --save-dev
  • create a flightplan.js file
@pcanterini
pcanterini / track
Last active October 19, 2016 20:24
Example of track with bad embed_code data
{
"updated_at": "2016-10-19T20:16:55Z",
"type": "ts",
"tracks": [{
"url_hash": "fc88ab7623ceb58a7ee77a7ea2f077462ab39d725645881e02a4308566d52719",
"url": "http://bleacherreport.com/articles/2670568-2016-17-nba-season-preview-predicting-who-will-be-this-years-breakout-star",
"updated_at": "2016-10-19T15:42:01Z",
"tag": {
"unique_name": "nba",
"tag_id": 19,
@pcanterini
pcanterini / docker_nuke.sh
Created November 19, 2016 17:12
docker_nuke
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi -f $(docker images -q)
@pcanterini
pcanterini / octopress deploy
Last active March 4, 2017 01:43
fix for octopress deploy - rake deploy is rejected
git clone https://github.com/username/username.github.io.git
git checkout source
Then we need to setup the deploy directory.
mkdir _deploy
cd _deploy
git init
git remote add -t master -f origin https://github.com/username/username.github.io.git
Done! Now we can make changes in source branch and use rake gen_deploy as usual.
@pcanterini
pcanterini / social-ua.md
Created March 23, 2017 22:53
Social browser User Agents (Twitter and Facebook UA)

Android

Facebook

Mozilla/5.0 (Linux; Android 4.4.4; One Build/KTU84L.H4) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/28.0.0.20.16;]

Twitter

Mozilla/5.0 (Linux; Android 4.4.4; One Build/KTU84L.H4) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets