Skip to content

Instantly share code, notes, and snippets.

View jescalan's full-sized avatar

Jeff Escalante jescalan

View GitHub Profile
@jescalan
jescalan / ignores.coffee
Last active December 30, 2015 00:39
Given an array of filenames and an array of minimatch patterns to ignore, return the array of files with any ignored paths removed
_ = require 'lodash'
minimatch = require 'minimatch'
remove_ignores = (files, ignores) ->
mask = []
mask.push _(ignores).map((i) -> minimatch(f.path, i)).contains(true) for f in files
files.filter((m, i) -> not mask[i])
@jescalan
jescalan / stylis-lib-rails.md
Created November 8, 2013 19:41
Getting stylus libraries into rails
  1. put gem stylus in your Gemfile.
  2. create an empty directory named node_modules
  3. run npm install your-lib
  4. make an initializer and add this text to it: Stylus.use('your-lib') if defined?(Stylus)
  5. make a new stylus file in your app/assets folder
  6. use your library
@jescalan
jescalan / swipe.js
Created November 4, 2013 20:12
component/swipe standalone build, does not break AMD but must be shimmed.
!function(){function t(n,e,i){var r=t.resolve(n);if(null==r){i=i||n,e=e||"root";var s=Error('Failed to require "'+i+'" from "'+e+'"');throw s.path=i,s.parent=e,s.require=!0,s}var o=t.modules[r];return o.exports||(o.exports={},o.client=o.component=!0,o.call(this,o.exports,t.relative(r),o)),o.exports}t.modules={},t.aliases={},t.resolve=function(n){"/"===n.charAt(0)&&(n=n.slice(1));for(var e=n+"/index.js",i=[n,n+".js",n+".json",n+"/index.js",n+"/index.json"],r=0;r<i.length;r++){var n=i[r];if(t.modules.hasOwnProperty(n))return n}return t.aliases.hasOwnProperty(e)?t.aliases[e]:void 0},t.normalize=function(t,n){var e=[];if("."!=n.charAt(0))return n;t=t.split("/"),n=n.split("/");for(var i=0;i<n.length;++i)".."==n[i]?t.pop():"."!=n[i]&&""!=n[i]&&e.push(n[i]);return t.concat(e).join("/")},t.register=function(n,e){t.modules[n]=e},t.alias=function(n,e){if(!t.modules.hasOwnProperty(n))throw Error('Failed to alias "'+n+'", it does not exist');t.aliases[e]=n},t.relative=function(n){function e(t,n){for(var e=t.length;e--;)i
@jescalan
jescalan / package.json
Created October 25, 2013 02:28
sample package.json for jsrepl
{
"name": "jsrepl",
"version": "0.0.1",
"author": "replit",
"description": "Node adaptation of jsrepl",
"main": "repl.js",
"repository": {
"type": "git",
"url": "https://github.com/replit/jsrepl"
},
@jescalan
jescalan / story.md
Created August 1, 2013 22:30
My response to @filamentgroup. #trolllife

Once upon a time, I saw this tweet by filament group.

tweet

I decided to vent some of my frustrations, and sent them this email:


Dear Filament Group,

@jescalan
jescalan / auth.js
Created June 24, 2013 16:35 — forked from kylemac/auth.js
// routes/auth.js
var passport = require('passport')
, LocalStrategy = require('passport-local').Strategy;
exports.member_auth = function(req, res) {
// console.log("Request Body == ", req.body);
var strategy = new LocalStrategy({
usernameField: 'email',
@jescalan
jescalan / rbenv.sls
Last active December 10, 2021 10:40
install latest ruby via rbenv using salt stack
#
# ruby deps
#
rbenv_deps:
pkg.installed:
- names:
- git
- build-essential
- openssl
@jescalan
jescalan / rbenv.sls
Last active December 18, 2015 05:29
rbenv sls
rbenv-deps:
pkg.installed:
- pkgs:
- bash
- git
- openssl
- gmake
- curl
ruby-2.0.0-p195:
@jescalan
jescalan / first_post.jade
Created May 15, 2013 17:47
You can perform some voodo magic within roots to transfer information from your dynamic content into your external javascript. This is a small sample of how one might do this, the specific example being infinite scroll functionality on a blog.
---
title: 'hello world'
---
:markdown
blah blah blah
@jescalan
jescalan / example.js
Created March 9, 2013 18:21
Javascript function declaration
// In this first example, I declare a function with what I call
// the 'standard' syntax, which is what I have taught. Because of
// this, I can make a call to the function before or after the declaration.
say_hello(); // logs 'hello world!'
function say_hello(){
console.log('hello world!');
}