Skip to content

Instantly share code, notes, and snippets.

@jaeschrich
jaeschrich / 404.html
Created August 6, 2012 20:00
Node.js project boilerplate.
<!DOCTYPE html>
<html lang="en"> <!-- based on HTML5 Boilerplate and Twitter Bootstrap starter template -->
<head>
<!-- You should probably use a local version of html5shim here. -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Envy</title>
@jaeschrich
jaeschrich / nano.js
Created August 25, 2012 20:11
Nano.js. A 25-line jQuery impersonator. Complete Version
var $ = function(s){ // Makes the main function (accepts one value)
var o = []// Makes an empty array
var sel = s.substring(1,s.length) // Get's the selector text minus the first character (like #)
switch (s.charAt(0)){ // Switch based on first chararcter
case '#': // If it's a #, do document.getElementById
o.push(document.getElementById(sel))// the element is pushed to o instead of the element being returned
break;
case '.': // If it's a ., get the element by class name
o.push(document.getElementsByClassName(sel))
break;
@jaeschrich
jaeschrich / nano.js
Created August 25, 2012 21:02
Nano.js. A 25-line jQuery impersonator. Incomplete version
var $ = function(s){ // Makes the main function (accepts one value)
var sel = s.substring(1,s.length) // Get's the selector text minus the first character (like #)
switch (s.charAt(0)){ // Switch based on first chararcter
case '#': // If it's a #, do document.getElementById
return document.getElementById(sel)
break;
case '.': // If it's a ., get the element by class name
var allEls = document.getElementsByTagName('*')
for (var i = 0;i<allEls.length;i++){
if (allEls[i].className === sel){

Bel.js

Super tiny JavaScript MVC framework

Features

  1. Very Small
  2. Event emitter (bel.Emitter)
  3. bel object is aliased in $
  4. the bel() function is overloaded, is an alias to document.querySelector()

Usage

@jaeschrich
jaeschrich / lamb.js
Last active October 13, 2015 03:18
A super-small javascript lambda function
/*
lamb.js
4 lines to lambda
*/
function lamb(s){
args = s.split("->")
return new Function(args[0], "return "+args[1])
}
@jaeschrich
jaeschrich / test.js
Last active July 20, 2022 20:49
A tiny node.js test framework with no dependencies
/*
Example
var test = require('./path/to/test'),
cake = require('..'),
assert = require("assert");
test('eat cake', function(done){
cake.eat();
done();
@jaeschrich
jaeschrich / wrap.js
Last active December 11, 2015 10:28
on off style event emitters with fall backs for older browsers
/**
* wrap
* Usage
* var a = document.querySelector('#test');
* wrap(a)
*
* or
*
* var a = wrap(document.querySelector('#test'));
*
@jaeschrich
jaeschrich / request.js
Last active December 14, 2015 16:08
tiny ajax wrapper
// not for POST/PUT requests
/**
* @function request
* @param {String} p The string to request (format "METHOD /path")
* @param {String} cb The callback. Takes 2 arguments, responseText and and XMLHttpReques object
*/
function request(p, cb){
var _p = p.split(' ' ),
method = _p[0],
path = _p[1],
#!/bin/bash
# get_bootstrap
# Usage
# sh get_bootstrap.sh <dest>
# downloads twitter bootstrap to <dest>
echo Fetching files...
curl http://twitter.github.io/bootstrap/assets/bootstrap.zip > bootstrap.zip
@jaeschrich
jaeschrich / buttons.css
Last active December 16, 2015 08:39
Simple, flat buttons
/*
simple, flat buttons
http://jsbin.com/icozal/2
*/
.btn-blue {
border-style: none;
border-radius: 0px;
background-color: #2BF;
-webkit-transition: background-color 0.2s;
-moz-transition: background-color 0.2s;