Skip to content

Instantly share code, notes, and snippets.

Avatar

James Smith st23am

  • GetThru
  • Cincinnati
View GitHub Profile
View app.js
// 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
require.define error in minified / unminified phoenix.js
View 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++)
View gist:e7c8cd8836169b4f3a80
app.js:92 Uncaught Error: Could not find module jquery
app.js:62 Uncaught Error: Cannot find module "web/static/js/app" from "/"
View gist:1cb1cee1ad68a08c629c
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;
View 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 Dec 31, 2015
Fizzbuzz in Elixir
View fizzbuzz.exs
#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
View jsbin.uJAgeRo.css
p {
padding-bottom: 5px;
border-bottom: 1px solid #000;
}
View Holiday_Vim_Hotness
" 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()
View robot3.rb
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 Oct 4, 2012 — forked from jimweirich/urinal.rb
Test Problem
View urinal.rb
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