Skip to content

Instantly share code, notes, and snippets.

View st23am's full-sized avatar

James Smith st23am

  • Adobe / Frame.io
  • Cincinnati
  • X @st23am
View GitHub Profile
// Brunch automatically concatenates all files in your
// watched paths. Those paths can be configured at
// config.paths.watched in "brunch-config.js".
//
// However, those files will only be executed if
// explicitly imported. The only exception are files
// in vendor, which are never wrapped in imports and
// therefore are always executed.
// Import dependencies
@st23am
st23am / Phoenix.js
Created May 14, 2015 00:04
require.define error in minified / unminified phoenix.js
!function() {
"use strict";
var e = "undefined" != typeof window ? window : global;
if ("function" != typeof e.require) {
var t = {}, n = {}, i = function(e, t) {
return {}.hasOwnProperty.call(e, t)
}, r = function(e, t) {
var n, i, r = [];
n = /^\.\.?(\/|$)/.test(t) ? [e, t].join("/").split("/") : t.split("/");
for (var o = 0, s = n.length; s > o; o++)
app.js:92 Uncaught Error: Could not find module jquery
app.js:62 Uncaught Error: Cannot find module "web/static/js/app" from "/"
import {Socket} from "phoenix";
import {Ember} from "ember";
// let socket = new Socket("/ws")
// socket.join("topic:subtopic", {}, chan => {
// })
let App = Ember.Application.extend({});
export default App;
@st23am
st23am / escript_crash
Created May 31, 2014 01:17
escript crash
./homunculus "test/**/*.coffee"
{"init terminating in do_boot",{undef,[{'Elixir.Mix.Utils',last_modified,[<<24 bytes>>],[]},{'Elixir.Homunculus.Watcher','-initial_state/1-fun-0-',1,[{file,"lib/watcher.ex"},{line,32}]},{'Elixir.Enum','-map/2-lc$^0/1-0-',2,[{file,"lib/enum.ex"},{line,967}]},{'Elixir.Homunculus.Watcher',initial_state,1,[{file,"lib/watcher.ex"},{line,32}]},{'Elixir.Agent.Server',init,1,[{file,"lib/agent/server.ex"},{line,7}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,306}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
@st23am
st23am / fizzbuzz.exs
Last active December 31, 2015 01:38
Fizzbuzz in Elixir
#FizzBuzz with module, named functions, and no conditional
defmodule Kata do
def fizzbuzz( 0, 0, _ ), do: "FizzBuzz"
def fizzbuzz( 0, _, _ ), do: "Fizz"
def fizzbuzz( _, 0, _ ), do: "Buzz"
def fizzbuzz( _, _, x ), do: "#{ x }"
def fizzbuzz(n) do
fizzbuzz(rem(n, 3), rem(n, 5), n)
end
end
p {
padding-bottom: 5px;
border-bottom: 1px solid #000;
}
" Thanks to Ben Orenstein
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Test-running stuff
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! RunCurrentTest()
let in_test_file = match(expand("%"), '\(.feature\|_spec.rb\|_test.rb\)$') != -1
if in_test_file
call SetTestFile()
@st23am
st23am / robot3.rb
Created November 20, 2012 23:13
BaselineBot
require 'rrobots'
class Robot3
include Robot
def tick events
@rapid_fire = 0 if @rapid_fire.nil?
@last_seen = 0 if @last_seen.nil?
@turn_speed = 3 if @turn_speed.nil?
if time - @last_seen > 200
@st23am
st23am / urinal.rb
Created October 4, 2012 21:45 — forked from jimweirich/urinal.rb
Test Problem
class Urinal
def initialize(occupied, line)
@occupied = occupied
@line = line
end
def select
scores = stalls.map { |n| [score(n), n] }
best = scores.sort.last
best.first < 0 ? nil : best.last