Skip to content

Instantly share code, notes, and snippets.

View jescalan's full-sized avatar

Jeff Escalante jescalan

View GitHub Profile
@jescalan
jescalan / loop.js
Created November 16, 2011 18:08
Handlebars No Name Loop
// The JSON
[
{
created_at: "2011-10-19T16:22:30Z",
id: 1,
link: "http://abcnews.go.com/Business/video/job-search-social-media-ditch-resume-hunt-nontraditional-ways-internet-professional-contacts-business-13581468",
title: "ABC News: Job Search Through Social Media",
updated_at: "2011-10-19T16:22:30Z"
},
@jescalan
jescalan / loop.js
Created November 16, 2011 19:16 — forked from wycats/loop.js
Handlebars No Name Loop
// The JSON (get back from api as javascript objects contained in an array)
// when logged to console, [▶Object,▶Object] etc.
// can be manipulated before being passed to handlebars
[
{
id: 1,
link: "http://abcnews.go.com/Business/video/job-search-social-media-ditch-resume-hunt-nontraditional-ways-internet-professional-contacts-business-13581468",
title: "ABC News: Job Search Through Social Media",
updated_at: "2011-10-19T16:22:30Z"
@jescalan
jescalan / .profile
Created December 23, 2011 18:36
.dotfiles
# Config Notes
# Dependencies: rbenv, ruby 1.9.3-p0, pow, powder, git, git_completion, grc
#
# path:
PS1='\[\e[0;31m\]⚡\[\e[m\] \[\e[0;30m\]${PWD##*/}\[\e[39m\] \[\e[0;33m\]$(__git_ps1 "(%s) ")\[\e[m\]'
# pretty colors (brew install grc)
source "`brew --prefix grc`/etc/grc.bashrc"
@jescalan
jescalan / example.html
Created December 24, 2011 23:10
Facebook getLoginStatus Example
<!DOCTYPE html>
<html>
<head>
<title>Facebook getLoginStatus Example</title>
</head>
<body>
<p>Check out the console to see if anything appears.</p>
<p>HERE'S THE CODE:</p>
<pre>
$(function(){
@jescalan
jescalan / scrape.rb
Created January 6, 2012 20:35
Ruby Amazon Scraper
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'colored'
# this is just a preview of what's to come - a proof of concept.
# it will be converted to a api-type library, gemified, and put in it's own repo
# for now, a cool way to experiment with amazon's data
query = 'ruby'
@jescalan
jescalan / mgr.sh
Created January 11, 2012 15:25
bash file management
# This script is a great shorcut for managing a large number of files.
# It runs through all the files in the present working directory, compares them
# against a regex, and then you can do what you want with the matches
for f in *
do if [[ "$f" =~ some_regex ]]
# do something to the files that match
# this is just an random example that zips them
then zip "$f.zip" $f
fi
@jescalan
jescalan / d3-css.js
Created January 21, 2012 18:33
jQuery-style css selector for d3 library
// D3: a data visualization library for javascript --http://mbostock.github.com/d3/
// Allows you to set multiple css properties at once
// Add this into the d3 source. Use like this d3.select('p').css({ color: 'red', 'font-size': '24px' });
d3_selectionPrototype.css = function(args) {
for (var key in args) {
var val = args[key]
this.style(key, val)
}
}
@jescalan
jescalan / challenge.rb
Created January 24, 2012 16:44
numbas
str = "iirytroyppytpeppowuiyoiuypipiyuyotyoiwiytorouqyiepyirueuiprpptwyiroqwtuyipourrrourorwipowiorutpwtwruuioquteorioriyutwqyyprptuqqquuituyywyuoewtrppqwrtiiruirpwyptpuoyyoeyerpqiotuieripurouwuwyuwrworowitoepoypeipeypiireeorrwripuuteoitpuutturruwiyryeetyrioweytueqrrrtotrpiqetoyepoipiwrwpppiritupwipruooiepoweypiuwrqywuuwyiroqpqpruioopuiuerputpwwuuiqwpiroewrtwiqerteoyeqtutwoeoipioiuqiiiouuoqtuuwtuwiiqwppqitywuqpuutrqiyoeuuutwrwtoqrqyoeyoiporuuioiwryoeruypreprqroiyuqwtuyoytoerwqryeeripryieypiwqirtriurueypiuyuypriuiwptywppupoioyrewooytreteeriiwroietuwypieeeeeqpiiiwrirtppoeyiwpooyyporpruwuoriiyowuytiwpwpryeywotoyirqypyypoeptiuwwoyprquoetepptorwiewprpiywwtuieeiweytrrwiqtwotioryoiptyyyuriiqiyroeeiqepwteuwptpruuypipieuoiiuuweeuryuuowporrooyywyyrryriqyirooitirueruptotpryoqtipippyptiurwyiryooywtryyuurtrutwqiqiiiqwouyeooueoturuowiuwrtruwwiupwopwweoo"
key_map = %w[q w e r t y u i o p]
number_map, result = [], []
# map to keyboard character
str.split('').each do |letter|
key_map.each_with_index do |key,index|
numb
@jescalan
jescalan / extension.sh
Created January 26, 2012 17:12
Bash, change file extensions
for f in *.jpeg; do mv "$f" "`basename "$f" .jpeg`.jpg"; done;
@jescalan
jescalan / split.sass
Created February 13, 2012 17:51
Split Mixin
=split($margin: 10px)
$left: $margin
$right: $margin
@if type-of($margin) == list
$left: nth($margin, 1)
$right: nth($margin, 2)
overflow: hidden
& > *
overflow: hidden