Skip to content

Instantly share code, notes, and snippets.

View jeandrek's full-sized avatar

Jeandre jeandrek

  • New Zealand
View GitHub Profile
@bobbyno
bobbyno / mit_scheme_bindings.txt
Created August 11, 2012 17:53
MIT Scheme bindings suitable for rlwrap completion
#
#!optional
#!rest
#(
#\
#\altmode
#\backnext
#\backspace
#\call
#\linefeed
@robmccoll
robmccoll / Named C Params
Created October 16, 2014 02:07
This is a preprocessor hack to emulate named parameters in C
#include <stdio.h>
typedef struct {
int len;
int * int_arr;
char * char_arr;
} print_arr_args;
#define print_array(...) print_array_impl((print_arr_args){__VA_ARGS__})
void print_array_impl(print_arr_args args) {
@hyperobject
hyperobject / phone.py
Last active October 28, 2015 00:35
Scratch->Phone
import requests
import time
num = 0
user = "technoboy10"
key = "get your own! :P"
message = "event name here"
scratch = 'https://api.scratch.mit.edu/proxy/users/' + user + '/activity/count'
ifttt = 'https://maker.ifttt.com/trigger/' + message + '/with/key/' + key
while True:
import re
from operator import *
i=lambda p: p if type(p)!=tuple else{"cons":lambda a,b:(a,b),"car":lambda a:a[0],"cdr":lambda a:a[1],"cadr":lambda a:a[1][0],"+":add,"-":sub,"*":mul,"print":print}[p[0]](*map(i,p[1:]))
while 1:i(eval(re.sub("[\n ]+",",",re.sub("[a-z+\-*]+","'\g<0>'",input()).replace("'nil'","''"))or"''"))
@BookOwl
BookOwl / cloudcoder.py
Created April 3, 2016 01:41
cloudcoder.py - Python module to go along with https://scratch.mit.edu/projects/103348115/
"""cloudcoder.py - Utilities for encoding and decoding strings for Scratch cloud data
Use the encode and decode functions to prepare strings to be stored in cloud variables
and to get strings out of them.
Examples:
>>> encode("I <3 the cloud")
'0x2F49203c332074686520636c6f7564'
>>> decode('0x2F49203c332074686520636c6f7564')
'I <3 the cloud'
@jeandrek
jeandrek / clickbait.js
Last active May 28, 2016 08:47
Better clickbait (more clickbaity) http://jonathan50.github.io/clickbait.html
function Words(...templates) {
this.templates = templates
}
Words.prototype.generate = function() {
return this.templates.map(generate).join(' ')
}
function generate(template) {
if(template instanceof Words)
return template.generate()