Skip to content

Instantly share code, notes, and snippets.

View evanshortiss's full-sized avatar
:octocat:
🇮🇪 🇺🇸

Evan Shortiss evanshortiss

:octocat:
🇮🇪 🇺🇸
View GitHub Profile
'use strict';
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
lintspaces: {
all: {
src: ['./src/**/*.js'],
@evanshortiss
evanshortiss / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@evanshortiss
evanshortiss / javascript_resources.md
Last active August 29, 2015 14:10 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@evanshortiss
evanshortiss / css_resources.md
Last active August 29, 2015 14:10 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@evanshortiss
evanshortiss / cordova-selection-alias.sh
Last active August 29, 2015 14:24
Alias that runs a function to determine which version of Cordova to use for your environment.
# Use a local version of Cordova when possible
alias cordova=exec_cordova_local
# Determine cordova version to use
exec_cordova_local() {
# Default path Cordova should be at if installed...
cpath="/usr/local/lib/node_modules/cordova/bin/cordova"
if [ -e node_modules/.bin/cordova ]
then
@evanshortiss
evanshortiss / async-filter.js
Last active October 8, 2015 19:03
async.filter - An Example of an Asynchronous filter
// Assumes you've included the async library
var async = window.async
, userInput = $('input').val() // <== just an example, could use ng-model too in angular
, originalList = getTheHugeDataSetFromSomewhere()
, $scope.items = [];
async.filter(originalList, function (item, cb) {
// Check does the user input exist in the name
for log in `fhc app logs list --app=irfeeciv4vf3uxwnlchbjwuj --env=tke-test --json\
| \grep -i "std" | sed 's/.*"\(.*\)"[^"]*$/\1/'`; do \
fhc app logs get --logname="$log" --app=irfeeciv4vf3uxwnlchbjwuj --env=tke-test --verbose; done > output.txt
'use strict';
var Promise = require('bluebird')
, express = require('express');
var app = express();
async function getUsers () {
return new Promise(function (resolve, reject) {
resolve(['jane', 'john']);
'use strict';
var express = require('express')
, async = require('async');
var app = express();
function getAges (callback) {
callback(null, ['23', '43']);
}
Every second run is using async await, i.e 1 & 3 uses the callback server, and 2 & 4 use async await.
eshortis@eshortis-OSX:~/workspaces/personal/aysnc-await$ ab -n 10000 -c 250 -r http://127.0.0.1:3001/
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests