Skip to content

Instantly share code, notes, and snippets.

View skinofstars's full-sized avatar

Kevin Carmody skinofstars

View GitHub Profile
@skinofstars
skinofstars / jobs_new_controller.js
Last active August 29, 2015 14:07
ember data not populating model errors
// using ActiveModelAdapter
App.ApplicationAdapter = DS.ActiveModelAdapter.extend();
// simple model
App.Job = DS.Model.extend({
external_ref: DS.attr("string")
});
// creating a new Job.
App.JobsNewController = Ember.Controller.extend({
@skinofstars
skinofstars / rock_paper_scissors.js
Last active August 29, 2015 14:10
BrumJS - rock paper scissors
// BrumJS - Rock Paper Scissors bots game
// http://www.meetup.com/Brum-JS/events/218927668/
// https://github.com/mancjs/rock-paper-scissors
// water beats dynamite
// dynamite beats everything (max 5 use)
// for keeping track of some stuff
var game = {};
game.me = {};
@skinofstars
skinofstars / application_routes.js
Created December 11, 2014 15:39
Ember rollback unsaved changes on navigation
// Extend from this for a user to get a notification for unsaved model changes
// and rollback the model if they choose to navigate away.
Ember.DSModelRoute = Ember.Route.extend({
deactivate: function() {
var model = this.get('controller.model');
model.rollback();
if (model.get('isNew')) {
model.deleteRecord();
}
},
@skinofstars
skinofstars / gitsubmodules.sh
Created January 26, 2015 18:21
pull git submodules
# every time, i forget how to pull submodules on a project where i forgot to do a --recursive clone/pull
git submodule init
git submodule update
### Keybase proof
I hereby claim:
* I am skinofstars on github.
* I am skinofstars (https://keybase.io/skinofstars) on keybase.
* I have a public key whose fingerprint is 969A 048C 6746 A52D 13C7 9267 AA1B 33F6 6ADB 691F
To claim this, I am signing this object:
@skinofstars
skinofstars / packer.json
Created March 18, 2015 11:50
Ansible packer.json example
{
"variables": {
"aws_access_key": "",
"aws_secret_key": ""
},
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "eu-west-1",
@skinofstars
skinofstars / .htaccess
Last active August 29, 2015 14:26
Some casual .htaccess gzip action
# normal rules before this
Options -Indexes
Header unset ETag
FileETag None
#Gzip
@skinofstars
skinofstars / deploy.yml
Last active March 17, 2016 11:40
super basic deploy playbook
---
# ansible-playbook -i hosts -l production deploy.yml
- hosts: production
vars:
app_root: '/home/ubuntu/app'
app_public: "{{app_root}}/public_html"
tasks:
- synchronize: src=blog dest={{app_public}}/
- copy: src=foobar.txt dest={{app_root}}/
@skinofstars
skinofstars / bulk-whois.sh
Created August 2, 2016 11:43
quick ISP lookup
#!/bin/bash
# USE
# - Save as bulk.sh, then run the commands
# - chmod +x bulk.sh
# - ./bulk.sh ip_addresses.txt
# It reads the ip_address.txt line by line,
# does a whois request on each line, and looks
# for the term 'netname' in each whois.
@skinofstars
skinofstars / deploy-ecr.sh
Created November 8, 2016 14:14
Some of the scripts needed to use Docker on AWS ECR and lastoc Beanstalk
#!/bin/bash
# usage: ./deploy-ecr.sh staging f0478bd7c2f584b41a49405c91a439ce9d944657
BRANCH=$1
SHA1=$2
AWS_ACCOUNT_ID=975486958832
NAME=moovyn
EB_BUCKET=moovyn-elasticbeanstalk