Skip to content

Instantly share code, notes, and snippets.

View alexanderankin's full-sized avatar

David Ankin alexanderankin

View GitHub Profile
@alexanderankin
alexanderankin / script.js
Created February 25, 2015 07:20
Jade got me feeling like 'undefined is not a fxn'
var fs = require('fs');
var jade = require('jade');
var writetofile = function(e){
// convert string to buffer so i can write it
var f = new Buffer(e, 'ascii');
// this is sitting in a folder where i can
// compare it to the html i have
fs.writeFile('/resources/wusbhtml/index1.html', f)
@alexanderankin
alexanderankin / schedule calendar.php
Created May 29, 2015 13:08
prototyping wusb.fm website
<?php
include 'schedulevariable.php';
function timemu($i) { // 'time markup', takes int i.
$meridian = $i < 12 ? " am" : " pm";
return ($i % 12) == 0 ? "12".$meridian : ($i % 12).$meridian;
}
function makemu($sch) { // 'make markup' out of a schedule variable.
// keep track of which blocks overlap.
module.exports =
{
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "ChIJpTvG15DL1IkRd8S0KlBVNTI",
"types" : [ "locality", "political" ]
},
{
"geocoder_status" : "OK",
# usage: `python ~/Desktop/contours.py 1994-654-12_v02.tif`
# output is to a squareless.txt file and the directory "out"
# Working well with thumbnails with 400px as their longest side - untested with other dimensions
# for i in $(ls -1 | grep tif); do python /Users/artsyinc/Documents/resistance/experiments/artwork_image_cropping/contours.py $i; done
import cv2
import numpy as np
from matplotlib import pyplot as plt
import sys
<?php
function rmdir_recursive ($dir) {
foreach (scandir ($dir) as $file) {
if ('.' === $file || '..' === $file)
continue;
if (is_dir ("$dir/$file"))
rmdir_recursive ("$dir/$file");
else
unlink ("$dir/$file");
}
@alexanderankin
alexanderankin / index.html
Created January 10, 2016 19:59
learning skrollr
<!-- This File is taken from https://prinzhorn.github.io/skrollr/ and formatted such that I can
learn the usage patterns of the skrollr library. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>skrollr - parallax scrolling for the masses</title>
var async = require('async');
var _ = require('underscore');
var phone = require('phone');
var request = require('request');
var ph = function (s) {
s += "";
return phone(s)[0];
}

usage

  • npm i
  • node untitled.js

and on the client

  • curl localhost:8000 | vlc -
@alexanderankin
alexanderankin / main_file.c
Last active August 24, 2016 23:31
Learning C: extern keyword
#include <stdio.h>
#include <stdlib.h>
#include "other_file.h"
int x;
int main(int, char **);
int main(int argc, char **argv) {
x = 5;
calculate();
@alexanderankin
alexanderankin / attempt1.c
Created October 24, 2016 23:51
leaky calculator
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum node_type
{
number, operation
} NType;
typedef enum op_type