Skip to content

Instantly share code, notes, and snippets.

@theblacksquid
theblacksquid / index.js
Created December 24, 2016 01:09
Generic code for serving static files using express
var express = require("express");
var app = express();
app.use(express.static(__dirname + "/"));
//app.get("/", function(req, res) {
// res.send('/')
@theblacksquid
theblacksquid / init.sh
Created December 22, 2016 16:39
Shellscript for creating new biwascheme-based projects
# init.sh
# shellscript to automate creating new projects
# initialize a git repo in current folder
# git init
# install express
# npm install --save express
@theblacksquid
theblacksquid / index.html
Created December 22, 2016 16:27
BIWASCHEME BOILERPLATE HTML FILE
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="IE=edge" >
<head>
<title>Title</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="lib/w3.min.css">
</head>
@theblacksquid
theblacksquid / localforage.scm
Created November 30, 2016 10:01
Biwascheme FFI for localforage, still in WIP
(js-load "https://cdnjs.cloudflare.com/ajax/libs/localforage/1.4.3/localforage.min.js" "window")
; the callback argument is passed two
; arguments, errors, and the value of
; the resulting function
; i.e. (lambda (err val) body), unless
; otherwise stated
; creates a new entry in the store
@theblacksquid
theblacksquid / init.sh
Created August 15, 2016 10:32
shell script to automatically create a coffeescript project
# init.sh
# shellscript to automate creating new projects
# initialize a git repo in current folder
git init
# initialize main folders
mkdir 'lib' 'src'
# create main files
touch 'src/index.coffee' 'src/views.coffee' 'src/templates.coffee' 'src/model.coffee'
@theblacksquid
theblacksquid / index.html
Created August 15, 2016 10:15
boilerplate html file
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="IE=edge" >
<head>
<title>Title</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link rel="stylesheet" href="lib/w3.min.css">
</head>
{exec} = require 'child_process'
task 'bake-dev', 'Build project from src/*.coffee to lib/*.js', ->
exec 'cat src/* | coffee --compile --stdio > lib/bundle.js', (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
console.log 'baking done. Development flavor.'
task 'bake-prod', 'Build project for production use. Compresses lib/bundle.js', ->
@theblacksquid
theblacksquid / index.coffee
Last active July 18, 2016 00:27
pure Coffeescript todos app
class Item
@_itemcount: 0
constructor: ->
@constructor._itemcount++ # refers to <classname>._itemcount
@id = @constructor._itemcount
@note = ""
@completed = false
@theblacksquid
theblacksquid / bi-background-lines.png
Last active July 18, 2016 04:22
Sigil Pal (UI and Logic) implemented in Coffeescript || <3
bi-background-lines.png
@theblacksquid
theblacksquid / calc.scm
Last active July 6, 2016 00:04
trying to implement an parser, stack and evaluator
(define stack
(let ((stk '()))
(lambda (msg . args)
(case msg
((peek) (car stk))
((push) (set! stk (cons (car args) stk)))
((pop) (let ((result (car stk))
(popped (cdr stk)))
(set! stk popped)