Skip to content

Instantly share code, notes, and snippets.

View ekryski's full-sized avatar

Eric Kryski ekryski

View GitHub Profile
@ekryski
ekryski / everyauth-override-example
Created July 8, 2011 16:37
Everyauth Functions Overriding
, validateRegistration: function (regParams, errors) {
if (regParams.password.length < 8)
errors.push('Password must be at least 8 characters. ');
return errors;
}
@ekryski
ekryski / gist:1217644
Created September 14, 2011 20:12
Jade Layout error
//Code
app.get('/admin', function(req, res){
res.locals({'title': 'TLF - Admin'});
res.render('admin', {layout: 'Admin/layout'});
});
//Error
SyntaxError: Unexpected identifier
@ekryski
ekryski / index.html
Created November 1, 2012 22:03
Full Bodied Sticky Footer
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Full Bodied Sticky Footer</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<style type="text/css">
@ekryski
ekryski / app.js
Last active December 11, 2015 11:48
Express Error Handler
app.configure( 'development', function () {
app.use( express.logger( {format: 'dev'} ) );
app.use( express.static( __dirname + '/public' ) );
app.use( errorHandler( { dumpExceptions: true, showStack: true } ) );
} );
@ekryski
ekryski / config.js
Last active July 25, 2018 09:13
Testing code client side with Mocha + Chai + RequireJS (to keep it clean)
require.config({
shim: {
'underscore': {
exports: '_'
},
'less': {
exports: 'LESS'
}
'mocha': {
exports: 'mocha'
@ekryski
ekryski / output
Created November 16, 2013 16:00
Error output for `brew install mapnik --verbose`
eric : examples $ brew install mapnik --verbose
==> Downloading http://mapnik.s3.amazonaws.com/dist/v2.2.0/mapnik-v2.2.0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/mapnik-2.2.0.tar.bz2
tar xf /Library/Caches/Homebrew/mapnik-2.2.0.tar.bz2
brew: PYTHONPATH=/usr/local/lib/python2.7/site-packages:/usr/local/Cellar/mapnik/2.2.0/lib/python2.7/site-packages:/usr/local/Cellar/mapnik/2.2.0/libexec/lib/python2.7/site-packages
==> /usr/bin/python scons/scons.py configure CC="clang" CXX="clang++" JOBS=4 PREFIX=/usr/local/Cellar/mapnik/2.2.0 ICU_INCLUDES=/usr/local/opt/icu4c/include ICU_LIBS=/usr/local/opt/icu4c/lib PYTHON_PREFIX=/usr/local/Cellar/mapnik/2.2.0 JPEG_INCLUDES=/usr/local/opt/jpeg/include JPEG_LIBS=/usr/local/opt/jpeg/lib TIFF_INCLUDES=/usr/local/opt/libtiff/include TIFF_LIBS=/usr/local/opt/libtiff/lib BOOST_INCLUDES=/usr/local/opt/boost/include BOOST_LIBS=/usr/local/opt/boost/lib PROJ_INCLUDES=/usr/local/opt/proj/include PROJ_LIBS=/usr/local/opt/proj/lib CAIRO=False
scons: Reading SConscript files
var AppConstants = require('../constants/constants');
var AppDispatcher = require('../dispatchers/app');
var Connections = require('../api/connection');
var ConnectionActions = {
loadConnections: function() {
Connections.find({}, function(error, connections){
if (error) {
AppDispatcher.handleViewAction({
action: AppConstants.LOAD_CONNECTIONS_FAIL,
@ekryski
ekryski / gist:3ab7d82505684ecbb891
Created January 9, 2016 20:08 — forked from jjb/gist:7389552
Ruby 2.1 memory configuration

This all applies to Ruby 2.1. In some cases a setting is not available in 2.0, this is noted. There is also a different with 1.9, 1.8, and REE --- these are not noted.

All the relevant code is in https://github.com/ruby/ruby/blob/trunk/gc.c

RUBY_HEAP_MIN_SLOTS

default: 10000

The number of heap slots to start out with. This should be set high enough so that your app has enough or almost enough memory after loading so that it doesn't have to allocate more memory on the first request (althogh this probably isn't such a big deal for most apps).

(todo: figure out how big a slot is. i think the answer can be infered from this code.)

@ekryski
ekryski / app.js
Last active February 19, 2019 20:20
How to use socket.io in React Native
// You need to set `window.navigator` to something in order to use the socket.io
// client. You have to do it like this in order to use the debugger because the
// debugger in React Native runs in a webworker and only has a getter method for
// `window.navigator`.
window.navigator.userAgent = 'ReactNative';
// Need to require instead of import so we can set the user agent first
// This must be below your `window.navigator` hack above
const io = require('socket.io-client/socket.io');
const socket = io('http://chat.feathersjs.com', {
@ekryski
ekryski / browser.js
Created March 4, 2016 08:34
Basic Feathers App
const host = 'http://localhost:3030';
let socket = io(host, {
transport: ['websockets']
});
// Set up Feathers client side
let app = feathers();
// Register hooks module
app.configure(feathers.hooks());
// Register socket.io