Skip to content

Instantly share code, notes, and snippets.

View olls's full-sized avatar
🐢

Oliver Faircliff olls

🐢
View GitHub Profile
@olls
olls / notepad.html
Last active May 10, 2024 11:24
A JavaScript notepad with open, save, local storage and markdown preview.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>NotePad!</title>
/*
A simple Node.js proxy for Twitter's OAuth API.
*/
var http = require('http');
var url = require('url');
var t = require('twitter-js-client');
var twitter = new t.Twitter({
"consumerKey": "###",
from math import sin, cos, tan, radians, pi, e, log
inp = 'e 2 ^ ln 3 * 60 cos 8 * + 4 0.5 ^ 3 * 1 - /'.split(' ')
stack = []
operators = {
'+': (2, lambda j, k: j + k),
'-': (2, lambda j, k: j - k),
'*': (2, lambda j, k: j * k),
'/': (2, lambda j, k: j / k),
@olls
olls / index.jade
Last active August 29, 2015 13:58
A listener for Github web hooks for pulling.
doctype html
html
head
title Git
style= css
body
#time
p= timestamp
#left
h2 Last Payload
@olls
olls / github-widget.js
Created May 11, 2014 10:16
A simple Github widget
function github_req(user, cb) {
makeRequest(
'https://api.github.com/users/' + user + '/events',
function (text) {
var data = JSON.parse(text);
cb(data);
}
);
}
@olls
olls / grade-avg.py
Last active August 29, 2015 14:05
An average grade calcuator
import sys
a=sys.argv[1].lower()
print(sum('*abcdeu'.find(g)/len(a)for g in a))
@olls
olls / console-animation.js
Last active August 29, 2015 14:06
A simple physics console animation in JS.
var stop = false;
var loop = function (d) {
if (stop){
return;
}
if (d == undefined) {
var d = {
width: 30,
height: 30,
x: 0,
@olls
olls / sine.py
Last active August 29, 2015 14:15
Trying to golf down an animated, coloured ASCII sine wave. Usage: `python3 sine.py [width] [height]`
import math,time,sys
j,i,p=int,0,print
W,H=map(j,sys.argv[1:])
while 1:y=0;exec("x=0;exec(\"d=math.sin(x*6/W)*math.sin(i);p('\x1b[3'+str(j(abs(d)*8))+'m'+' #'[j(H/2*(1+d))==y],end='');x+=1;\"*W);p();y+=1;"*H);i+=.1;time.sleep(.1)
@olls
olls / pro.fish
Last active August 29, 2015 14:26
Project Initialiser
function pro
set name $argv[1]
mkdir $name
if test $status = 0
cd $name
git init
printf (echo $name | sed -e 's/^./\U&/' | tr _ ' ' | tr '-' ' ')\n(head -c (expr length + $name) < /dev/zero | tr '\0' '=')\n > README.md
@olls
olls / make-and-run.sh
Last active October 6, 2018 15:18
A script to run my build in the terminal from anywhere!
#!/bin/bash
function build-and-run {
build "$1" && $2
}
function build {
clear
# run $1, pipe output to stdout then strip colour and put in .build_results
$1 2>&1 | tee >(perl -np -e 's/\x1b\[[0-9;]*m//g' > .build_results)