Skip to content

Instantly share code, notes, and snippets.

View avesus's full-sized avatar
🎯
Focusing

Brian Cannard avesus

🎯
Focusing
View GitHub Profile
@danielstjules
danielstjules / sockjs_ws.patch
Created June 30, 2014 15:39
Patch to use ws with sockjs-node rather than faye-websocket-node
From ae279bfe194b1b17a6dc18e0720e61d253414154 Mon Sep 17 00:00:00 2001
From: "Daniel St. Jules" <danielst.jules@gmail.com>
Date: Thu, 8 May 2014 18:59:20 -0400
Subject: [PATCH] Replace faye-websocket-node with ws
---
package.json | 4 ++--
src/trans-websocket.coffee | 15 +++++++--------
2 files changed, 9 insertions(+), 10 deletions(-)
@bsharper
bsharper / HOWTO
Last active August 29, 2015 14:10
Diff to allow BPG Image format library (http://bellard.org/bpg/) to compile on OS X 10.10.2
# If you run this as a script it should patch and compile BPG for you
wget http://bellard.org/bpg/libbpg-0.9.tar.gz
tar xvzf libbpg-0.9.tar.gz
cd libbpg-0.9
wget https://gist.githubusercontent.com/bsharper/dd517547f6e1bcabf6be/raw/d125ab609e07e4fd624137543d36eb48bcaab91b/bpg_osx.patch
patch -p1 < bpg_osx.patch
# Output should be:
# patching file Makefile
# patching file libavutil/mem.c
# If you see something like "patch unexpectedly ends in middle of line" it should still work
@pelonpelon
pelonpelon / finite_state_machine.js
Created April 29, 2015 22:08
Example finite state machine - credit: Nijiko Yonskai (https://github.com/Nijikokun)
function state (namespace) {
if (!namespace) return internalState[internalState.length - 1]
internalState.push([namespace, options])
m.redirect(namespace, options)
}
function goto (namespace, options) {
return function (e) {
e.preventDefault()
e.stopPropagation()
@sakamies
sakamies / dabblet.css
Created March 28, 2012 10:37
Pixel Perfect CSS Rotation
/* Pixel Perfect CSS Rotation */
body {
text-align: center;
}
.clock {
display: inline-block;
background: black;
border-radius: 100%;
width: 101px;
height: 101px;
@StephanHoyer
StephanHoyer / inlineedit.js
Last active October 13, 2015 16:46
Inline edit mithril component
'use strict';
var m = require('mithril');
var extend = require('lodash').extend;
var setFocus = require('../util/viewhelper').setFocus;
var keymage = require('keymage');
function noop(){}
function addClass(el, className) {
@avesus
avesus / centos.md
Last active December 13, 2015 10:57
Configs

xset r rate 170 77 setxkbmap -layout "us,ru" -option "grp:caps_toggle" -option "grp_led:scroll" -option "compose:ralt"

@wmertens
wmertens / q-promise-cache.coffee
Created June 21, 2013 10:30
Using cached promises for better resource use
# We have a function that loads some resource. It might get called multiple times by our application, for example a web server.
# We use a stored promise to serve as both a cache and a hook for multiple callers to get the same result
# JavaScript version at the bottom
Q = require 'q'
loadPromise = null
doLoad = ->
if not loadPromise
# get a fresh result
loadPromise = Q.delay(1000).then -> Date.now()
# after 1 second clear cache
#include <IOKit/IOTypes.h>
#include <IOKit/IOKitLib.h>
#include <CoreSurface/CoreSurface.h>
#include <stdio.h> // For mprotect
#include <sys/mman.h>
#ifdef __cplusplus
extern "C" {
#endif
@Naddiseo
Naddiseo / mjsx_loader.js
Last active June 16, 2016 12:58
Babel plugin to compile jsx to mithril compiled code. Released under BSD 3-clause
/* global require, module */
var isString = require('lodash/lang/isString');
var htmlTags = (
'^(html|base|head|link|meta|style|title|address|article|' +
'body|footer|header|h[1-6]|hgroup|nav|section|dd|div|dl|dt|' +
'figcaption|figure|hr|li|main|ol|p|pre|ul|a|abbr|b|bdi|bdo|br|' +
'cite|code|data|dfn|em|i|kbd|mark|q|rp|rt|rtc|ruby|s|samp|small|span|strong|sub|' +
'time|u|var|wbr|area|audio|img|map|track|video|embed|iframe|object|param|source|' +
'canvas|noscript|script|del|ins|caption|col|colgroup|table|tbody|td|tfoot|th|thead|tr|' +
@avesus
avesus / nginx.conf
Last active December 1, 2017 05:55
Nginx perfect nodern SPA config
location /app/ {
expires max;
}
location /img/ {
expires max;
}
location = /favicon.ico {
try_files $uri =204;