Skip to content

Instantly share code, notes, and snippets.

View jason-s13r's full-sized avatar

Jason Schwarzenberger jason-s13r

View GitHub Profile
@jason-s13r
jason-s13r / MockAjax.js
Last active August 29, 2015 14:24
silly little thing.
function MockAjax() {
var self = this;
var responses = {
'http://api.example.com/cart/add.json?a=5&b=3': {
"data": 8
}
};
function request(url, success, failure) {
window.setTimeout(function () {
function hangman(word) {
var reference = word.replace(/[a-zA-Z]/g,'-');
function reveal(letter) {
reference = reference.split('').map(function(v, i){
return word[i] === letter ? letter : v;
}).join('');
return reference;
};
return {
reveal: reveal
@jason-s13r
jason-s13r / not-ie.js
Created April 22, 2015 05:19
Small is or is not internet explorer. Provides .ie or .is-ie and .not-ie css classes.
(function(n, o, t, i, e){
n.isIE = t;
if (t) {
o.styleSheets[0].addRule('.ie, .is-ie', 'display: initial');
o.styleSheets[0].addRule('.not-ie', 'display: none');
return;
}
i = o.createElement('style');
i.innerHTML = '.ie,.is-ie { display: none; } .not-ie: { display: initial; }'
e = document.getElementsByTagName('script')[0];
konami(function(){
console.log('KONAMI!!!');
});
function konami(fn, match) {
var konamiCode = '3838404037393739666513';
var sequence = '';
match = match || konamiCode;
window.addEventListener('keyup', function(event){
sequence += event.keyCode;
@jason-s13r
jason-s13r / index.html
Created February 28, 2015 10:18
Simpler Name Generator Thing
<html>
<head></head>
<body>
<strong>Markov Team Name Generator</strong><br />
<button id="get-markov-name">Get Name</button><br />
<strong>Generated Name:</strong>
<span id="generated-name">click Get Name to generate a name</span><br />
<textarea style="min-width:200px; min-height: 400px;" id="previous-names"></textarea><br />
@jason-s13r
jason-s13r / index.html
Last active August 29, 2015 14:16
Name Generator
<html>
<head></head>
<body>
<strong>Markov Team Name Generator</strong>
<br />
<button id="get-markov-name">Get Name</button>
<p>First table shows names generated by creating a first name starting with the most common first two letters, and a last name starting with the most common first two letters.</p>
<table border=1>
@jason-s13r
jason-s13r / WebSocketRpc.js
Last active August 29, 2015 14:11
WebSocket RPC
function WebSocketRpc(url, batchOperationsDisabled) {
'use strict';
var self = this;
var socket = null;
var queue = [];
var history = {};
var methods = {};
var noop = function () {};
var noopFactory = function () {
return noop;
Verifying that +master5o1 is my Bitcoin username. You can send me #bitcoin here: https://onename.io/master5o1
<!DOCTYPE html>
<html>
<head>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha256.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
<script src="libs/bitnz-angular/bitnz-angular.js"></script>
<script src="js/pretty-bitnz.js"></script>
<style>
</style>
</head>
angular.module('BitNZ', []).factory('Api', ['$http', '$log', function ($http, $log) {
'use strict';
var api = {};
var host = 'https://bitnz.com/api/0';
var config = {
username: '',
key: '',
secret: ''
};