Skip to content

Instantly share code, notes, and snippets.

View jescalan's full-sized avatar

Jeff Escalante jescalan

View GitHub Profile
@jescalan
jescalan / juicy.js
Created May 15, 2012 15:30
It's all good baby baby
biggie = Notorious.new("BIG")
you = Person.new(self)
var it = "all a dream"
biggie.read("Word Up Magazine")
limosine = ["Salt & Pepper", "Heavy D"]
wall.hang("pictures")
if ((new Date).toString().substr(0,3) == "Sat") {
var rap_attack = Array.new
rap_attack.push("Mr. Magic", "Marley Marl")
@jescalan
jescalan / shakespearian_insults.coffee
Created May 18, 2012 17:46
Release the shakespearian insults!
# Because sometimes curses are not enough.
request = require 'request'
module.exports = (robot) ->
robot.respond /release the shakespearian insults/i, (msg) ->
request uri: 'http://www.pangloss.com/seidel/Shaker/index.html', (err, res, body) ->
msg.send body.match(/<font size="\+2">\s(.*)<\/font>/)[1].replace(/<br>/, " ")
@jescalan
jescalan / sample.rb
Created June 25, 2012 14:05
generate csv
# This is the easiest way to generate a csv and have it downloaded by the user.
# Drop this in a method in the controller and call it on click.
require 'csv'
file = CSV.generate do |csv|
csv << ["Name", "Email"] # headers
Contact.all.each do |person|
csv << [person.name, person.email]
end
@jescalan
jescalan / join.rb
Created June 27, 2012 15:43
image series > sprite
# This script runs through all the png images in a passed folder and sprites them
require 'fileutils'
puts "processing files..."
files = []
Dir["#{ARGV.first}/*.png"].each do |f|
files << f
end
@jescalan
jescalan / index.html
Created September 14, 2012 21:19
base html
<!DOCTYPE html>
<html>
<head>
<title>Flexible UI With SASS</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400' rel='stylesheet'>
<link rel='stylesheet' href='master.css' />
</head>
<body>
<h1>Flexible UI With SASS</h1>
<div class='container'>
@jescalan
jescalan / spec.coffee
Last active December 10, 2015 02:28
compiler spec (pseudocode)
# error handling
# --------------
compiler.on 'error', ->
utils.add_error_messages()
this.finish()
compiler.one 'finished', ->
console.log 'compilation done'
@jescalan
jescalan / toggle.js
Created February 7, 2013 17:49
css toggle
$('.switch').on('click', function(){
var modes = ['night', 'day'];
var current = this.hasClass('on') ? 0 : 1;
$('link[href=' + modes[current] + '.css').attr('href', + modes[~~current] + '.css');
this.toggleClass('on');
})
@jescalan
jescalan / .profile
Created February 13, 2013 03:46
Create a file called .profile at your user root (~/) and paste this in. Then run the command `source ~/.profile` to reload your terminal.
# path:
PS1='\[\e[0;33m\]⚡\[\e[m\] \[\e[0;31m\]${PWD##*/}\[\e[m\] '
# general shorcuts
alias ll="ls -lahG"
alias reload="source ~/.profile"
alias up="cd .."
alias back="cd -"
alias desktop="cd ~/Desktop"
alias server="python -m SimpleHTTPServer"
@jescalan
jescalan / instructions.md
Last active December 13, 2015 19:29
I often run php apps alongside ruby, node, etc. MAMP drives me crazy because it's slow, doesn't work with pow, and only uses it's own mysql install, when i already have a system mysql install for everything else. This is how to get php apps running without MAMP on OSX Lion.

Running PHP Apps Without MAMP on OSX Lion

  1. Create a ~/Sites folder if you don’t already have one
  2. Enable PHP by uncommenting the php5_module line in /etc/apache2/httpd.conf
  3. Find the line that read User _www and change the _www to your username (whoami)
  4. Find the DirectoryIndex line and change it to DirectoryIndex index.php index.html index.htm
  5. Change the DocumentRoot line to DocumentRoot "/Users/yourusername/Sites/"
  6. Change the <Directory line to <Directory "/Users/yourusername/Sites/">
  7. Run sudo apachectl restart
  8. Restart your computer (yes, this is necessary)
@jescalan
jescalan / example.js
Created February 23, 2013 22:13
example code for the class
$(function(){
var element = $('#boxes li').first();
element.toggleClass('selected');
console.log(element);
});