Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jahfer on github.
  • I am jahfer (https://keybase.io/jahfer) on keybase.
  • I have a public key whose fingerprint is 43C9 6189 2FA5 E5BE B1E3 CDEB 65B1 4B90 1BD7 3365

To claim this, I am signing this object:

/* default mobile styling goes here.. */
/* then we progressively apply stylings for other widths */
/* Desktop */
@media (min-width: 767px) {
}
/* Tablets in Portrait */
@jahfer
jahfer / sse.js
Last active December 23, 2015 11:49
Simple SSE Server in Node (taken from somewhere online!)
var PORT = 8081;
var http = require("http");
var fs = require("fs");
var url = require("url");
http.createServer(function (request, response) {
var parsedURL = url.parse(request.url, true);
var pathname = parsedURL.pathname;
if (pathname === "/admin/push") {
goxc() {
echo "+-BUILD START-----------------------------------------------------------------+"
echo "Building Linux binary..."
GOOS=linux GOARCH=386 CGO_ENABLED=0 go build -o $1.linux $1.go
echo "Building OS X binary..."
go build $1.go
echo "Building Windows binary..."
GOOS=windows GOARCH=386 go build -o $1.exe $1.go
echo "+-BUILD COMPLETE--------------------------------------------------------------+"
}
@jahfer
jahfer / omitlist.js
Created April 26, 2013 17:55
List of common words to omit
// from: http://www.webconfs.com/stop-words.php
var omit = ["able","about","above","abroad","according","accordingly","across","actually","adj","after","afterwards","again","against","ago","ahead","ain't","all","allow","allows","almost","alone","along","alongside","already","also","although","always","am","amid","amidst","among","amongst","an","and","another","any","anybody","anyhow","anyone","anything","anyway","anyways","anywhere","apart","appear","appreciate","appropriate","are","aren't","around","as","a's","aside","ask","asking","associated","at","available","away","awfully","back","backward","backwards","be","became","because","become","becomes","becoming","been","before","beforehand","begin","behind","being","believe","below","beside","besides","best","better","between","beyond","both","brief","but","by","came","can","cannot","cant","can't","caption","cause","causes","certain","certainly","changes","clearly","c'mon","co","co.","com","come","comes","concerning","consequently","consider","considering","c
package main
import (
"fmt"
"time"
)
func main() {
// set up our in/out pipe
nums := make(chan int, 3)
@jahfer
jahfer / arraynavigation.js
Created December 18, 2012 05:15
Sometimes you need to look ahead or behind the current element you're on when iterating through an array. This is a neat trick for doing that quickly, without stepping outside the bounds of your array.
var arr = ['a','b','c'];
// 1. LOOKING AHEAD
// -----------------------------
for (var i=0; i<arr.length; i++) {
var next = arr[ (i+1) % arr.length ]; // <= THE MAGIC
console.log(arr[i], "->", next);
}
@jahfer
jahfer / clearfix.css
Created June 24, 2012 15:32
CSS: Clearfix
.group:before,
.group:after {
content:"";
display:table;
}
.group:after {
clear:both;
}
.group {
zoom:1; /* For IE 6/7 (trigger hasLayout) */
@jahfer
jahfer / center.css
Created June 24, 2012 15:30
CSS: Center child w/ unknown size
/* Source: http://css-tricks.com/centering-in-the-unknown/ */
/* This parent can be any width and height */
.block {
text-align: center;
}
/* The ghost, nudged to maintain perfect centering */
.block:before {
content: '';
@jahfer
jahfer / index.html
Created June 3, 2012 23:29
HTML: Base
<!doctype html>
<!--[if lt IE 9]><html class="ie"><![endif]-->
<!--[if gte IE 9]><!--><html><!--<![endif]-->
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title></title>