Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am avifoxi on github.
  • I am aviatchegg (https://keybase.io/aviatchegg) on keybase.
  • I have a public key whose fingerprint is 6D3F 7D6C AE04 6ABE 052A 6711 5AA9 2140 4BAC 9F53

To claim this, I am signing this object:

@avifoxi
avifoxi / gist:895e8fe1504597d6546e
Created Sep 2, 2014
AR one page associations workout
View gist:895e8fe1504597d6546e
require 'active_record'
require 'minitest/autorun'
require 'minitest/spec'
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
ActiveRecord::Migration.create_table :users do |t|
t.string :name
@avifoxi
avifoxi / MVC for WebAudio Sample Loading + Playback
Last active Aug 29, 2015
Attempting to put the Web Audio API into a scaleable JS MVC structure - using Boris Smus' intro to Web Audio article + book, and Alex Netkachov's JS MVC article
View MVC for WebAudio Sample Loading + Playback
/// EVENT LINKING UTILITY CLASS FOR IMPLEMENTING OBSERVER PATTERN super coooool... thanks to http://alexatnet.com/articles/model-view-controller-mvc-javascript
function Event(sender) {
this._sender = sender;
this._listeners = [];
}
Event.prototype = {
attach : function (listener) {
this._listeners.push(listener);
@avifoxi
avifoxi / gist:3489f1e95d93fd956d4b
Created Aug 14, 2014
intercepting form submission - then get the data
View gist:3489f1e95d93fd956d4b
// shorthand for $(document).ready();
$(function(){
//Your code...
var f = $('form');
$(f).submit( function(event){
event.preventDefault();
var children = event.currentTarget.childNodes;
var shitwecareabout = []
View goldfinger_user_deck_author
## within Deck MODEL
belongs_to :author, class_name :user
# in the DECK migration - add column
t.references :author
# in USER MODEL
has_many :played_decks, through: :rounds, source: "Deck"
You can’t perform that action at this time.