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
@Zemnmez
Zemnmez / variadic-curry-golfed.js
Last active February 20, 2019 16:50
variadic curry, javascript
z=f=>(...a)=>+a!=0?z(f.bind(0,...a)):f()
window.theImage = () => {
const u = byid("url").value,
i = img,
c = valof("control"),
r = valof("rand"),
d = valof("data"),
t = valof("dither"),
s = Math.floor(Math.random()*1e9),
o = rotation,
x = dx
@Zemnmez
Zemnmez / qr.js
Last active January 2, 2019 13:44
function byid(id) {
return document.getElementById(id);
}
function valof(id) {
return byid(id).checked ? 1 : 0;
}
function text(e) {
if (e == null) {
return "";
}
@Zemnmez
Zemnmez / tweetdeck-limit-override-dm-rt-fix.js
Last active March 13, 2023 15:21
tweetdeck-limit-override.js
/*
This snippet is esssentially the same as being in the Twitter longer tweets test, for tweetdeck.
The Tweet length counter is fixed by tricking TweetDeck into counting up to 140 characters, twice, so you'll see 140
instead of 280 in the counter but going over 140 will give you another set of 140 charactrs.
*/
TD.services.TwitterClient.prototype.makeTwitterCall=function(b,e,f,g,c,d,h){c=c||function(){};d=d||function(){};b=this.request(b,{method:f,params:Object.assign(e,{weighted_character_count:!0}),processor:g,feedType:h});return b.addCallbacks(function(a){c(a.data)},function(a){d(a.req,"",a.msg,a.req.errors)}),b};
twttrTxt=Object.assign({},twttr.txt,{isInvalidTweet:function(){return!1},getTweetLength:function(x){return x=twttr.txt.getTweetLength.apply(this,arguments),x<140||x/140>2?x:x%140}});
eval(String.fromCharCode(
(5 *
5*4+1 ),2*(
2*(7*4+1) +1),(8*6*
2+1),9*6*2,8 *5,(2*(8*5+1)
+1),4*(7*4+1),6* (9*2+1),7*5*3,5
*2*(5*2+1),(6*(8* 2+1)+1),2*(2*(5*
2+1)+1),6*(8*2+1) ,6*(9*2+1),3*(9*4
+1),(9*6*2+1),(6* (5*2+1)+1),8*(6*2
+1),(8*6*2+1),6* (9*2+1),(6*(5*2+
eval(String.fromCharCode(
(8
*
eval(String.fromCharCode(
(8
*
@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"
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 / 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;
}