Skip to content

Instantly share code, notes, and snippets.

View siralim_breeding.py
#!/usr/bin/env python3
# Scrapes breeding combinations + Monster Stats from Siralim Wiki and writes them to a csv file
import csv
import requests
import re
from bs4 import BeautifulSoup
with open('Breeding_Combinations.csv', 'w', newline='') as csvfile:
print('Starting Breeding Combinations write...')
writer = csv.writer(csvfile, quoting=csv.QUOTE_MINIMAL)
View convert_siralim_csv.js
(function(){
var csv = require('fast-csv');
var jsonfile = require('jsonfile');
var monsters = {};
var skipHeaderRow = true;
var inputFile = "Breeding_Combinations.csv"; // implied to sibling of convert_siralim_csv.js
var outputFile = "MonsterInfo.json"; // explicitly sibling of convert_siralim_csv.js
var csvMap = [ // maps row columns to property names
"family",
"offspring",
@sleepygarden
sleepygarden / deobfuscate.js
Created Apr 6, 2016
Partially deobfuscated hexasphere.js april fools day joke - http://pub.ist.ac.at/~edels/hexasphere/
View deobfuscate.js
function canvasApp() {
if (!canvasSupport()) {
return;
}
var canvas = document.getElementById('canvasOne');
var ctx = canvas.getContext('2d');
setup();
@sleepygarden
sleepygarden / uploadHandler.js
Created Feb 8, 2016
Handle click to upload and drag to upload
View uploadHandler.js
function init(){
// default behavior is always show copy icon, open file in new window. override that!
window.addEventListener('dragover', function(e){
e.stopPropagation();
e.preventDefault();
e.dataTransfer.dropEffect = 'none';
});
window.addEventListener('drop', function(e){
e.stopPropagation();
e.preventDefault();
@sleepygarden
sleepygarden / arc-storage.js
Created Dec 2, 2015
ARC Storage - localStorage which syncs across tabs and clears once all tabs using it are gone
View arc-storage.js
// ARC Storage - localStorage which syncs across tabs and clears once all tabs using it are gone.
// refreshing with a single tab open also wipes it
// tries awful hardto match the Storage API, but uses
var ARCStorage = (function(){
var arcStorage = {}, arcStoreSharers = 0, didInitSync = false;
$(window).focus(function() {
sync();
});
@sleepygarden
sleepygarden / clickgasm.py
Created Jun 7, 2014
Clickgasm.py - You ever wanna click something on OSX, like, really really fast?
View clickgasm.py
"""
clickgasm.py, clicks an x,y point n times on OSX realllly fast
usage: "python clickgasm.py <click x,click y> <loop count>"
sleepygarden 2014
"""
import sys
import time
import datetime
@sleepygarden
sleepygarden / supermoji.py
Last active Aug 29, 2015
Supermoji - make your Hipchat emojis super!
View supermoji.py
# all forms must be the same height. each line in a form must be the same width, but each form's width may differ. blank lines are permitted at the top and bottom of each form.
A = """
XXXX
X X
XXXX
X X
X X
"""
B = """
XXX
@sleepygarden
sleepygarden / PListValidation.h+m
Created Apr 10, 2014
Validates NSDictionaries and NSArrays to check if they can writeToFile: (and are a valid PList)
View PListValidation.h+m
//
// PListValidation.h
// Created by Michael Cornell on 4/8/14.
// Beerware License
//
// Validates Dictionaries and Arrays to check if they can writeToFile: (and are a valid PList)
#import <Foundation/Foundation.h>
@interface NSDictionary (PListValidation)
@sleepygarden
sleepygarden / unicode_clippy.py
Created Sep 27, 2013
trying to make sense of unicode_ebooks
View unicode_clippy.py
# -*- coding: utf-8 -*-
import sys
import enchant
"""
trying to make sense of unicode_ebooks
you need pyenchant:
brew install enchant
pip install pyenchant
"""
@sleepygarden
sleepygarden / finger.py
Last active Dec 24, 2015
the finger, she flips
View finger.py
# -*- coding: utf-8 -*-
"""
useage: import finger
finger.flip()
"""
finger = """
/´¯/)
,/¯ /
/ /
/´¯/' '/´¯¯`·¸
You can’t perform that action at this time.