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 / practice_list.c
Created October 28, 2011 02:56
Practising C by implementing a simple doubly linked list.
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
struct list_node {
char* name;
int age;
struct list_node* previous;
struct list_node* next;
};
@jason-s13r
jason-s13r / linked_list.cpp
Created November 1, 2011 06:31
Practising C++ by implementing doubly Linked List clases for the list and the nodes.
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
/* List Node: */
template <class T>
class MyNode {
@jason-s13r
jason-s13r / linked_list.html
Created November 1, 2011 11:15
Linked List in JavaScript.
<!DOCTYPE HTML>
<html>
<head>
<title>Linked List</title>
<script type="text/javascript"><!--
function ListNode(data) {
this.data = data;
this.next = null;
this.previous = null;
@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" : ""));
};
@jason-s13r
jason-s13r / ghetto.js
Created November 6, 2012 11:38
ghetto, based on xbot's !ghetto
var ghetto = function(str, part) {
var gTable = ghettoTable;
return str.split(" ").map(function(T) {
function tr(U) {
return gTable[U.toLowerCase()] || U
}
if(part === true) {
return T.length < 5 ? T : T.substring(0, Math.ceil(T.length * 0.75)) + "-" + T.substring(Math.ceil(T.length * 0.75)).split("").map(tr).join("")
}else {
return T.split("").map(tr).join("")