Skip to content

Instantly share code, notes, and snippets.

import fnmatch
import os
import subprocess
def execute_command(bashCommand):
return subprocess.check_output(bashCommand.split(),stderr= subprocess.STDOUT)
libraries = {}
for root, dirnames, filenames in os.walk('libs'):
matches = []

Create the config

The following jobs will require a config variable is set, so it knows where all your javascript files are located.

var config = {
    all_js_src: ['./app/**/*.js']
}

Remove trailing whitespace on lines

@amorri40
amorri40 / 2bpp-with-canvas.js
Last active September 16, 2016 17:47
Gameboy Tile rendering - 2 bytes per pixel - javascript
// https://jsfiddle.net/aeyajxac/1/
var colour_map = {
0:"rgb("+255+","+255+","+255+")", //white
1:"rgb("+192+","+192+","+192+")", //light grey
2:"rgb("+96+","+96+","+96+")", // dark grey
3:"rgb("+0+","+0+","+0+")" // black
}
$(document).ready(function() {
//
@amorri40
amorri40 / PCGamerDVDSubscriptionPasswords.md
Last active August 30, 2015 17:38
PC Gamer UK Magazine - DVD Subscription Passwords

In the PC Gamer UK Magazine a free DVD (called DVD Gamer) contained extra content for subscribers only if you have the special subscription Password, here are those subscription passwords:

Month Year - password

October 2001 - exciter

November 2001 - apeman

December 2001 - flowers

Xmas 2001 - trees

@amorri40
amorri40 / rename_files.py
Created July 4, 2015 13:28
Rename cbz/cbr files to standard format
import os,re
import glob
# def getFiles(dirname, suffixPattern=None):
# dirname=os.path.normpath(dirname)
# retDirs, retFiles=[], []
# for root, dirs, files in os.walk(dirname):
# for i in dirs:
# retDirs.append(os.path.join(root, i))
@amorri40
amorri40 / Gruntfile.js
Created March 2, 2015 12:20
Prettify Javascript and HTML on every save with Grunt!
//
// # Prettify Javascript files
//
"jsbeautifier": {
files: ["<%= config.app %>/js/*{,*/}*.js", './dashboards/**/*.js', './app/**/*.js', './bin/**/*.js'],
options: {}
},
//
// # Prettify HTML files
@amorri40
amorri40 / gist:072e520dafea4477cf83
Created November 23, 2014 08:50
How can I create a website based on github gists?
http://gist.io seemed like a good solution but it doesn't seem to work anymore.
@amorri40
amorri40 / Does Cython allow you to write iOS applications that compile natively?
Created November 23, 2014 08:44
Does Cython allow you to write iOS applications that compile natively?
Seems to be possible in a project called Kivy:
http://kivy.org/docs/guide/packaging-ios.html
Kivy seems pretty interesting:
Kivy - Open source Python library for rapid development of applications
that make use of innovative user interfaces, such as multi-touch apps.
But not sure how much it forces the user to code in thier own style..
@amorri40
amorri40 / useful.js
Last active August 29, 2015 14:07
useful Javascript
/*
Angular
*/
//http://stackoverflow.com/questions/13681116/angularjs-dynamic-routing
/**
* Inserts a warning box under the current cursor location
*/
function insertWarningTableAtCursor() {
if (!doesTheUserWantToContinue('This will insert a warning Box at your current cursor location, are you sure you want to do this?')) return;
var cursor = DocumentApp.getActiveDocument().getCursor();
if (!cursor) {showCursorError(); return;}