Skip to content

Instantly share code, notes, and snippets.

View Zemnmez's full-sized avatar
💭
oof

Thomas Neil James Shadwell Zemnmez

💭
oof
View GitHub Profile
package main
import (
"errors"
"flag"
"fmt"
"os"
"os/exec"
"strings"
"time"
//I hate javascript
function attributes(el) {
var n = Function.call.bind(Array.prototype.shift, arguments);
el = n();
for (var z=n();z!=void 0;z=n())
el.setAttribute(z, n());
};
//I hate javascript
function attributes(el) {
var n = Array.prototype.shift.bind(arguments);
el = n();
for (var z=n();z!=void 0;z=n())
el.setAttribute(z, n());
};
@Zemnmez
Zemnmez / lambda.sjs
Last active August 29, 2015 14:02
Python style lambda functions for Javascript
macro lambda {
rule { $arg:ident: $stm:expr (,) ... } => { function($arg) {
return $stm (,) ...;
}}
rule { $arg:ident (,) ...: $stm:expr (,) ...} => {function(x){
var i = 0, $($arg = x[i++]) (,) ...;
return $stm (,) ...;
}}
}
@Zemnmez
Zemnmez / chimera.vim
Created July 1, 2014 19:40
Golang colourscheme for vim.
" Chimera by Zemnmez
" It's a slightly clumsy mix of molokai, zenburn and busybee.
" It has extra highlighting for Go and Python.
" MIT License.
set background=dark
hi clear
movie 'C:\Users\IEUser\Documents\graph.swf' {
// flash 8, total frames: 1, frame rate: 12 fps, 680x180 px, compressed
movieClip 2 {
}
movieClip 8 {
frame 1 {
stop();

Keybase proof

I hereby claim:

  • I am zemnmez on github.
  • I am zemnmez (https://keybase.io/zemnmez) on keybase.
  • I have a public key whose fingerprint is F0B8 4C8A 0DE4 9407 F9B4 1948 901A 20DB 9560 EB9F

To claim this, I am signing this object:

@Zemnmez
Zemnmez / phishingcolor.js
Created August 18, 2014 23:40
Puts a coloured div in the top left hand corner that is random and seeded from the hash of the hostname.
function hash(s) {
var hash = 0, i, chr, len;
if (s.length == 0) return hash;
for (i = 0, len = s.length; i < len; i++) {
chr = s.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
function dynamicLoadYT(el) {
var videoIDParts = /youtu\.be\/(.*)/;
// invalid link
if (!videoIDParts) return;
var videoID = videoIDParts[1];
//generate a callback function
// (most people would do this with jQuery)
@Zemnmez
Zemnmez / sizes.sh
Created April 4, 2017 16:34
resizes a target image (can be gif) to given formats usage ./sizes.sh in.gif 10x20 20x40
#!/bin/bash
set -e
originalSize="$(identify -format "%wx%h\n" $1|head -1)"
tmp="${1%%.*}-temp.${1#*.}"
convert $1 -coalesce -layers Optimize "$tmp"
for SZ in "${@:2}"; do
convert -size "$originalSize" "$tmp" -resize "$SZ" \
"${1%%.*}-$SZ.${1#*.}"
done
rm "$tmp"