Skip to content

Instantly share code, notes, and snippets.

View jason-s13r's full-sized avatar

Jason Schwarzenberger jason-s13r

View GitHub Profile
javascript:window.setInterval(function(){$("#clickers, #sellers, #upgrades, #banks").find('[id$="_cst"]').each(function(){var b=$(this),a=b.text().replace(/[\$,]/g,""),c=a.replace(/[0-9\.]/g,""),a=1*a.replace(/[A-Z]/,""),c={Q:1E15,T:1E12,B:1E9,M:1E6}[c]||1,a=a*c,d=$("#seller_rps"),c=$("#sell_amt"),d=d.text().replace(/,/g,""),c=c.text().replace(/,/g,""),a=(a-c)/d,b="#"+b.attr("id").replace("_cst","_btn"),b=$(b);0<a?(a="Purchase in "+a.toFixed(0)+" seconds",b.html(a)):b.html("Purchase")})},1E3);
@jason-s13r
jason-s13r / thing about Question.js
Last active December 18, 2015 10:39
Why do I even do these things.
// Consider this a class for the Question object.
function Question(question) {
var self = this;
// Private variables:
var correct = null;
var answers = [];
// Public Methods:
@jason-s13r
jason-s13r / array things.js
Last active December 18, 2015 03:39
I've been nursing this in a JS Fiddle for a short time now. Just been playing with the LINQ methods and how they would be in JS. I find OrderBy and GroupBy are interesting.
var run = function (arr) {
'use strict';
var onlyStrings = l('x => typeof x === "string"');
var onlyNums = l('x => typeof x === "number"');
var selector = l('x => typeof x');
var grouper = l('x => typeof x');
var selectE = l('x => x');
var evenIndex = l('(x, index) => index % 2 === 0');
console.clear();
# vim: noai:ts=4:sw=4:expandtab:syntax=python
import re
from xbotpp.modules import Module
class lolcrypt(Module):
"""\
Provide lolcryption.
"""
(function(_){
_.mixin({
wordCaps: function(s){
return s.toLowerCase()
.replace(/^[a-z]/, function(a){ return a.toUpperCase(); })
.replace(/ [a-z]/g, function(a){ return a.toUpperCase(); });
},
camelCase: function(s){
return _.wordCaps(s).replace(/ /g, '');
},
map = (list, func = ((x, i, l) -> x)) ->
result = (func(elem, index, list) for elem, index in list)
return result
each = (list, func) ->
map(list, func)
return
filter = (list, func = ((x, i, l) -> x)) ->
result = []
function s2n(str) {
return str.split('').map(function (c) {
var r = [' ', '.', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'].map(function (m, i) {
var n = m.toLowerCase().indexOf(c.toLowerCase())
if (n > -1) return i;
return '';
}).join('');
return r.length <= 0 ? c : r;
}).join('');
}
* You are now known as JSON|work
<JSON|work> More than 50 long-serving TAB workers look set to lose their jobs as the agency prepares to close its Auckland phone betting centre at Ellerslie.
<JSON|work> The workers have put in a submission through the Service and Food Workers Union asking the agency to keep the 27 Auckland employees who want to stay on, instead of hiring 25 new staff to replace them in the two remaining phone betting centres in Wellington and Christchurch.
<JSON|work> But the Racing Board, which owns the TAB, says it will save $1 million a year by selling its Ellerslie building for about $3 million, closing the Auckland phone operation and hiring half as many extra staff within existing facilities in the other two centres.
<JSON|work> Board media manager John Mitchell said the board would pay relocation costs for any Auckland staff willing to move south.
<JSON|work> But he said 22 of the 54 Auckland staff were aged 65 or over. Most others have worked at Ellerslie for many years and can't move
@jason-s13r
jason-s13r / queue.js
Last active December 14, 2015 23:19
I only just noticed how Google Analytics sets up gaq = gaq || [] and the ndoes gaq.push([], ...) and stuff for commands. So I wondered how I might be able to make a similar queue thing. Felt like being silly a bit too...
var j = j || [];
j.push('first');
j.push('second.1', 'second.2');
j = (function(q){
function J() {
var self = this;
self.queue = [];
var secretKey = ((Math.random()*10e16) + new Date().getTime()).toString(36);
@jason-s13r
jason-s13r / console-jsfiddle.md
Last active December 12, 2015 02:58
When I use JS Fiddle, I find myself wanting console.log() stuff to show up in the output pane as well as the actual JavaScript console.

When I use JS Fiddle, I find myself wanting console.log() stuff to show up in the output pane as well as the actual JavaScript console.

  • console(...) is the real console.log(...)
  • console.log(...) is the output pane + real console.log(...)
  • console.clear() deletes everything in the ol/ul tag.
  • console._ is mapped to the original browser console.
console.log('hello', 'world')
 .clear()