Skip to content

Instantly share code, notes, and snippets.

View StoneCypher's full-sized avatar

John Haugeland StoneCypher

View GitHub Profile

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

@StoneCypher
StoneCypher / ts.js
Last active August 25, 2018 05:05
comment time; make generic the name of the range label
function timeString(userMilliseconds) {
var // the actual data ranges. now trivial to extend
ranges = [
{ range: 86400, singular: 'day', plural: 'days' },
{ range: 3600, singular: 'hour', plural: 'hours' },
{ range: 60, singular: 'minute', plural: 'minutes' },
{ range: 1, singular: 'second', plural: 'seconds' }
],
%% 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)); }
@StoneCypher
StoneCypher / gist:f2adbd4fd448e47d3d15
Created July 21, 2014 02:14
APL highlighter test case
⍝ You can try this at http://tryapl.org/
⍝ I can not explain how much I suddenly love this crypto-language
+-÷×!?*⌈|⌊⊥⊤⍟○⌹{}
()⍴¨⍨⍣,⍪⌽⊖⍉
⍺ ⍺⍺ ⍵ ⍵⍵
⍬ ⎕FMT
10 -20 ¯20 0 0.0 ¯123.45
1> F = "什麽是".
[20160,40637,26159]
2> B = unicode:characters_to_binary(F).
<<228,187,128,233,186,189,230,152,175>>
3> F2 = unicode:characters_to_list(B).
[20160,40637,26159]
<!doctype html>
<html>
<head>
<script type="text/javascript">
function byId(X) { return document.getElementById(X); }