Skip to content

Instantly share code, notes, and snippets.

@zspecza
zspecza / index.js
Created February 15, 2016 17:02
requirebin sketch
// vars ending in $ are streams
var flyd = require('flyd')
var botkit = require('botkit')
var controller = botkit.slackbot(/*...*/)
var direct_message$ = flyd.stream()
var conversation$ = flyd.stream()
@zspecza
zspecza / simple-slack.js
Last active August 20, 2019 11:57
A simplified API for working with Slack
import fetch, {
Response } from 'node-fetch';
import qs from 'querystring';
import WebSocket from 'ws';
class SimpleSlack {
baseURL = 'https://slack.com/api/';
eventListeners = {};
connection = null;
@zspecza
zspecza / react-page.js
Last active August 29, 2015 14:24
A simple, isomorphic, state-based routing component wrapper around Page.js for React
import page from 'page'
import pathToRegExp from 'path-to-regexp'
import querystring from 'querystring'
import HomePage from './components/HomePage'
import ProfilePage from './components/ProfilePage'
import NotFoundPage from './components/NotFoundPage'
// generate expression for iterating over object keys
function entries(obj) {
@zspecza
zspecza / amok_browserify_gulpfile.js
Last active November 23, 2021 07:46
Live inject CSS, Javascript & HTML with BrowserSync, Watchify, Amok & Gulp (excuse the messiness, still a WIP)
/*=====================================*\
build tasks
\*=====================================*/
/**
* This gulpfile is optimised for developing
* React.js apps in ES6 through Babel, and is
* designed to live-inject CSS, HTML and even JavaScript
* changes so maintaining state in an application when
* editing code is super easy.
@zspecza
zspecza / modernizr.styl
Last active August 29, 2015 14:02
modernizr helper mixins for stylus
/* private modernizr mixin
*
* downside - only works on single-element selectors. nesting still works though.
*
* @param features - a list of modernizr test classes e.g.: csstransitions opacity OR csstransitions, opacity
* @param declaration - the {block} of content passed by the block mixins +yep()/+nope()
* @param support - boolean, true if testing support, false if testing no support
*
* 1. if testing for support, set selector to empty string
* if testing for no support, set selector to ".no-js" appended by
@zspecza
zspecza / number-base-conversion.js
Last active August 29, 2015 13:57
A little brainstorm on converting between number bases in JavaScript. Feedback is welcome.
;(function(undefined) {
'use strict';
var debug = function(err) {
console.error(err.message + '\n' + err.stack);
};
try {
@zspecza
zspecza / css-preprocessor-spec.md
Last active December 17, 2022 21:01
The Coolest CSS Pre-Processor MicroSpec You'll Ever See

CSS Preprocessor Micro-Specification

Introduction

This is a conceptual specification for what could/would/should be the preprocessor to end all preprocessors. Unfortunately, it is just that - a specification. I had made quite a few attempts to create a CSS preprocessor, but I am far too inexperienced with advanced programming to succeed at this task. I got as far as the scanner and half of a half-working tokenizer before proceeding to pull my hair out. So I gave up, and decided just to list the proposed features here for reference. Perhaps these will make their way into existing pre-processors, or even inspire the birth of a new one.

First off, the basic features:

Pretty much everything the 3 leading pre-processors offer in terms of:

@zspecza
zspecza / brainfuck.coffee
Created December 13, 2013 02:27
Brainf*ck Interpreter
###
brainfuck() function
description: takes a string of Brainfuck code and returns the parsed result
usage: brainfuck('++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.')
// output: 'Hello World.'
###
brainfuck = (code) ->
inp = '23\n'
out = ''
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"create_window_at_startup": false,
"default_line_ending": "unix",
"detect_slow_plugins": false,
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
@zspecza
zspecza / stylus-best-practices.md
Last active May 27, 2021 05:25
Stylus Best Practices

Stylus Best Practices

Introduction

This is a curated set of conventions and best practices for Stylus, an expressive, dynamic, robust and advanced CSS preprocessor. Frustrated with there not being a set of conventions set in place (that could be easily found), I set forth to find out on my own.