Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
oof

Thomas Neil James Shadwell Zemnmez

💭
oof
View GitHub Profile
View waituntil.go
package main
import (
"errors"
"flag"
"fmt"
"os"
"os/exec"
"strings"
"time"
View attributes.js
//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());
};
View atrr2.js
//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 Aug 29, 2015
Python style lambda functions for Javascript
View lambda.sjs
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 Jul 1, 2014
Golang colourscheme for vim.
View chimera.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
View gist:bd1587bdfc7d151aacbe
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();
View keybase.md

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 Aug 18, 2014
Puts a coloured div in the top left hand corner that is random and seeded from the hash of the hostname.
View phishingcolor.js
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;
}
View dynamicLoadYT.js
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 Apr 4, 2017
resizes a target image (can be gif) to given formats usage ./sizes.sh in.gif 10x20 20x40
View sizes.sh
#!/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"