Skip to content

Instantly share code, notes, and snippets.

View kristoferjoseph's full-sized avatar
🐘
💨

kj kristoferjoseph

🐘
💨
View GitHub Profile
@cowboy
cowboy / ba-postMessage-detect.js
Created September 15, 2010 16:50
postMessage detector
/*!
* postMessage detector - v0.1pre - 9/15/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
// If `window.postMessage.complex` is true, postMessage can pass complex non-string
@emk
emk / comet_client.coffee
Created September 19, 2010 03:39
Real-time Comet with Faye, Node.js and Coffee
# Client-side Comet code. See comet_server.coffee for instructions.
client = new Faye.Client '/faye', timeout: 90
# Attach a security key to all our subscription messages.
client.addExtension
outgoing: (msg, callback) ->
return callback(msg) unless msg.channel is '/meta/subscribe'
(msg.ext ?= {}).authToken = 'secret'
callback(msg)
@max-mapper
max-mapper / bundle.js
Created November 8, 2012 19:03
ratchet color schemer
var require = function (file, cwd) {
var resolved = require.resolve(file, cwd || '/');
var mod = require.modules[resolved];
if (!mod) throw new Error(
'Failed to resolve module ' + file + ', tried ' + resolved
);
var cached = require.cache[resolved];
var res = cached? cached.exports : mod();
return res;
};
@kristoferjoseph
kristoferjoseph / .vimrc
Created April 2, 2013 16:57
Copy of my hand tuned .vimrc file
"PATHOGEN
execute pathogen#infect()
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
"RELOAD VIMRC
nmap <silent> <leader>sv :so $MYVIMRC<CR>
nmap <silent> <leader>ev :e $MYVIMRC<CR>
"LEADER
@conradz
conradz / gist:7686821
Created November 28, 2013 03:21
rework-npm

rework-npm

I recently published rework-npm that allows you to import CSS files using the same rules that the Node.js uses for modules. This lets you install and manage CSS packages using npm the same way you manage JS modules.

Why npm?

First of all, why use npm? Why does it make sense to use npm for CSS? Npm is good for a number of reasons.

First, it is simple to use. Want to publish a module? Just use npm publish. Want to install a new package and save it to the dependencies? Just use npm install --save mymodule. This makes it super easy to create and maintain small modules, instead of putting everything into one large module.

@yocontra
yocontra / gulpfile.js
Last active January 1, 2016 00:29
gulpfile for a simple livereload static web server. this is a proof of concept that uses no plugins to do the work. obviously there are plugins that eliminate almost all of this code but i thought it would be a fun demonstration. this will trigger livereload any time any file is modified in the current working directory. it also serves the curre…
var gulp = require('gulp');
var gutil = require('gulp-util');
var express = require('express');
var path = require('path');
var tinylr = require('tiny-lr');
var createServers = function(port, lrport) {
var lr = tinylr();
lr.listen(lrport, function() {
gutil.log('LR Listening on', lrport);
@Stuk
Stuk / promise-debug.js
Last active October 2, 2016 21:39
I've found this code useful for debugging promises, to find what order things are happening in. `console.error` gives a stack trace in the Webkit Developer Tools which makes easily narrow down where the promise creation and resolution is happening.
var Q = require("q");
var Set = require("collections/set"); // https://npmjs.org/package/collections
window.outstandingPromises = new Set();
var originalDefer = Q.defer;
Q.defer = function () {
console.error("Deferred created");
var deferred = originalDefer();
deferred.stack = new Error("").stack;
window.outstandingPromises.add(deferred);
1. Design Your Own
If you are willing / able to learn some 3D design skills, that might be the most flexible
option. With a design and a 3D printer, you can design pretty much any kind of enclosure
you can imagine and modify it as your project evolves.
Here's a good tutorial about designing enclosures from Ben Heck:
https://www.youtube.com/watch?v=03Ju_LJlU3U
@yyx990803
yyx990803 / vue-element.html
Last active October 15, 2017 11:50
Vue custom element draft
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Vue.js custom element example</title>
<script src="../dist/vue.js"></script>
</head>
<body>
<my-element msg="custom message">original content</my-element>
<script>
@MoOx
MoOx / less2stylus.js
Created August 27, 2012 17:37 — forked from lancejpollard/less2stylus.coffee
Convert LESS to Stylus
// Usage : less2stylusDir('../src/css/');
var fs = require('fs');
// this less 2 stylus conversion script make a stylus easy to read syntax
// - let the braces
// - replace the @ for var as $
// - let semicolons
function less2stylus(less)