Skip to content

Instantly share code, notes, and snippets.

View StoneCypher's full-sized avatar

John Haugeland StoneCypher

View GitHub Profile
@StoneCypher
StoneCypher / gist:11097999
Last active August 29, 2015 14:00
general structure of a receive driven process
some_loop() ->
receive
case ->
handle,
some_loop();
case ->
handle,
@StoneCypher
StoneCypher / gist:11187594
Created April 22, 2014 17:25
found this cleaning up editor windows, huhu
chunk(List) ->
part(List, []).
chunk([], Acc) ->
lists:reverse(Acc);
chunk([H], Acc) ->
@StoneCypher
StoneCypher / gist:11362556
Created April 28, 2014 05:37
san francisco box old version text

Unexpected San Francisco Box!

Welcome to your very own Unexpected San Francisco Box ™. This is something your idiot engineer friend made up. Sharing culture with deep PA. Play along.

Contents

  • Four CA local cheeses
@StoneCypher
StoneCypher / chicken.js
Last active August 29, 2015 14:00
I STOLED THIS CODE lul
/* code blatantly stolen from @asterick */
(function chicken() {
function textNodesUnder(el, transform){
var n, a = [], walk = document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);
while (n=walk.nextNode()) { transform(n); }
}
textNodesUnder(document.body, function (el) {

So, instead of requiring your customers to recite their passwords to unidentifiable strangers over the telephone, you could use a randomly generated PIN instead. Then, you could present that PIN inside the customer's account, where they could read it out to you.

This carries all the advantages of making sure the person you're speaking with has their password, but with none of the downsides, such as giving the password to a customer service member in plain text (thereby allowing them to write it down,) or giving your customer service staff a mechanism to test whether customer passwords

%% teaching the use of a testing library. bad code, do not use or judge
-module(vlp).
-export([
square/1
]).
square(7) -> -2;
-module(vlp_tests).
-compile(export_all).
-include_lib("proper/include/proper.hrl").
-include_lib("eunit/include/eunit.hrl").
square_test_() ->
{ "Square test", [
-module(vlp_tests).
-compile(export_all).
-include_lib("proper/include/proper.hrl").
-include_lib("eunit/include/eunit.hrl").
@StoneCypher
StoneCypher / show-between.directive.js
Last active August 29, 2015 14:02 — forked from callumacrae/show-between.directive.js
Patch for simplification requested on IRC. Regards lines 23,24, vs 23-31 in the original.
'use strict';
/* global angular */
var app = angular.module('playground', []);
app.directive('showBetweenHours', function () {
return {
restrict: 'AC',
link: function (scope, element, attrs) {
var Pricers = {
"us": { cur: "$", price: function(Slots) { return (Slots*10)+10; } },
"ru": { cur: "E", price: function(Slots) { return Slots*0.5; } }
};
function curFmt(Cur, X) { return Pricers[Cur].cur + X.toString(); }
function price(Cur, Amt) { return curFmt(Cur, Pricers[Cur].price(Amt)); }