Skip to content

Instantly share code, notes, and snippets.

View wulymammoth's full-sized avatar
processing unit

David W wulymammoth

processing unit
View GitHub Profile
@wulymammoth
wulymammoth / MVC.js
Last active January 15, 2019 21:20
/* MVC */
// MODEL
function ModelBase(attributes) {
for (var attr in attributes) {
this[attr] = attributes[attr];
}
this._eventHandlers = {};
}
@wulymammoth
wulymammoth / gist:8d6124f9462554e34958da79161e7539
Created November 14, 2016 23:41 — forked from lopopolo/gist:9427762
Relink all homebrew formulae after Mavericks upgrade
▶ brew list -1 | while read line; do brew unlink $line; brew link $line; done
Unlinking /usr/local/Cellar/appledoc/2.2... 0 links removed
Linking /usr/local/Cellar/appledoc/2.2... 1 symlinks created
Unlinking /usr/local/Cellar/autoconf/2.69... 0 links removed
Linking /usr/local/Cellar/autoconf/2.69... 18 symlinks created
Unlinking /usr/local/Cellar/bash-completion/1.3... 184 links removed
Linking /usr/local/Cellar/bash-completion/1.3... 182 symlinks created
Unlinking /usr/local/Cellar/bgrep/0.2... 0 links removed
Linking /usr/local/Cellar/bgrep/0.2... 1 symlinks created
Unlinking /usr/local/Cellar/binutils/2.24... 49 links removed
find . -d -name node_modules | while read line; do rm -rf $line; done
@wulymammoth
wulymammoth / railway_programming_in_elixir.md
Last active February 16, 2020 09:50
Railway Programming in Elixir
@wulymammoth
wulymammoth / ScriptInjection.js
Created February 3, 2017 02:28 — forked from ThomasBurleson/ScriptInjection.js
Script injection with Deferred/Promises (non-jQuery)
/**
* Module that implements non-jQuery script injection with Deferred/Promise support (using
* Q.js ).
*
* This deferred load notifies caller when the script is loaded... so chaining
* or post load actions is easily supported.
*
*/
( function( win, doc, $q ){
"use strict";
@wulymammoth
wulymammoth / accounts.ex
Last active March 24, 2017 14:41
Example of new 1.3 Phoenix module generator
# foo/lib/foo/accounts/accounts.ex
defmodule Foo.Accounts do
@moduledoc """
The boundary for the Accounts system.
"""
import Ecto.{Query, Changeset}, warn: false
alias Foo.Repo
@wulymammoth
wulymammoth / expng.ex
Created May 13, 2017 05:38 — forked from zabirauf/expng.ex
PNG format Parser in Elixir
defmodule Expng do
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks]
def png_parse(<<
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
_length :: size(32),
"IHDR",
width :: size(32),
height :: size(32),
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.11759774386882782</real>
@wulymammoth
wulymammoth / README.md
Created July 24, 2017 01:06 — forked from rbishop/README.md
A super simple Elixir server for sending Server Sent Events to the browser.

Generate a new Elixir project using mix and add cowboy and plug as dependencies in mix.exs:

  defp deps do
    [
      {:cowboy, "~> 1.0.0"},
      {:plug, "~> 0.8.1"}
    ]
  end
@wulymammoth
wulymammoth / decode_session_cookie.rb
Created August 2, 2017 17:01 — forked from pdfrod/decode_session_cookie.rb
A simple script to decode Rails 4 session cookies