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 / 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];
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 / 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 () {
"""
lolcryption.py
Translates text into LOLcrypted ciphertext. <http://lolcryption.master5o1.com/>
Created By:
- Jason Schwarzenberger <https://github.com/master5o1>
License:
MIT
"""
from cloudbot import hook
@jason-s13r
jason-s13r / calendar.lua
Created August 2, 2012 10:24
Practising lua by making a calendar thing.
#!/usr/bin/env lua
function february(year)
if year == nil or year == "context" then year = os.date("%Y"); end
if year%4==0 and (year%100~=0 or year%400==0) then
return 29
else
return 28
end
end
@jason-s13r
jason-s13r / Array.prototype.js
Created October 30, 2012 06:25
doing !js this.toSource() on woot then http://jsbeautifier.org/
Array.prototype.reduce = function (c) {
if(null === this || void 0 === this) {
throw new TypeError("O is null or undefined");
}
var a = 0,
d = this.length >> 0,
b;
if("function" !== typeof c) {
throw new TypeError("1st arg is not callable");
}
@jason-s13r
jason-s13r / LOLcryption.js
Created November 2, 2012 08:09 — forked from passcod/LOLcryption.js
enLOLcryption.
String.prototype.enlolcrypt2 = function () {
var cipher = "aeoiubcdfghjklmnpqrstvwxyz";
return this.split("").map(function (T) {
var c = /[A-Z]/.test(T), T = T.toLowerCase(), i = cipher.indexOf(T);
if (/[^a-z]/.test(T)) { return T; }
if (/[aeoiu]/.test(T)) {
T = cipher[(i+2)%5];
} else {
T = cipher[(i+5)%21+5];
@jason-s13r
jason-s13r / LOLcryption.js
Created November 2, 2012 08:23 — forked from passcod/LOLcryption.js
enLOLcryption.
String.prototype.enlolcrypt2 = function () {
var cipher = "aeoiubcdfghjklmnpqrstvwxyz";
return this.split("").map(function (T) {
var c = /[A-Z]/.test(T), T = T.toLowerCase(), i = cipher.indexOf(T);
if (/[^a-z]/.test(T)) { return T; }
if (/[aeoiu]/.test(T)) {
T = cipher[(i+2)%5];
} else {
T = cipher[(i+5)%21+5];
@jason-s13r
jason-s13r / LOLcryption.js
Created November 2, 2012 21:18 — forked from passcod/LOLcryption.js
enLOLcryption.
String.prototype.enlolcrypt2 = function () {
var cipher = "aeoiubcdfghjklmnpqrstvwxyz";
return this.split("").map(function (T) {
var c = /[A-Z]/.test(T), T = T.toLowerCase(), i = cipher.indexOf(T);
if (/[^a-z]/.test(T)) { return T; }
if (/[aeoiu]/.test(T)) {
T = cipher[(i+2)%5];
} else {
T = cipher[(i+5)%21+5];
@jason-s13r
jason-s13r / attack.js
Created November 6, 2012 08:46
xbot js attack ;)
var attack = function (to) {
var user = to || Object.keys(bot.users)[Math.floor(Object.keys(bot.users).length * Math.random())];
var attack = attacks[Math.floor(attacks.length * Math.random())];
return attack.replace(/\{defender\}/g, user)
.replace(/\{attacker\}/g, bot.caller)
.replace(/{year}/g, Math.round(Math.random() * 10000) + (Math.random() * 100 < 35 ? "BC" : ""));
};