Skip to content

Instantly share code, notes, and snippets.

@nateberkopec
nateberkopec / Gemfile
Last active March 17, 2022 08:21
ActionCable isn't *really* a Rails 5 dependency.
# gem 'rails'
gem "activerecord"
gem "actionpack"
gem "actionview"
gem "actionmailer"
gem "activejob"
gem "activesupport"
gem "railties"
gem "sprockets-rails"
gem 'sqlite3'
@francis2110
francis2110 / LG infrared codes
Created January 22, 2015 10:01
Lg infrared codes for making your own remote
on-off->20DF10EF
energy->20DFA956
av. mode->20DF0CF3
input->20DFD02F
tv/rad->20DF0FF0
1->20DF8877
2->20DF48B7
3->20DFC837
4->20DF28D7
5->20DFA857
@EyePulp
EyePulp / example.js
Last active December 18, 2015 04:28
knockout.js, jquery, and tastypie: Automattically perform a "PUT" to your model's resource_uri when certain observables change value
// usage inside a vm:
var fooVM = function(){
var self = this;
var resource_uri = ko.observable('/api/v1/foo/');
var bar = ko.observable(1);
var baz = ko.observable(1);
ko.saveOnChange(self,['bar']);
}
var f = new fooVM();
f.bar(2); // causes a PUT to /api/v1/foo/
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"