Skip to content

Instantly share code, notes, and snippets.

View jescalan's full-sized avatar

Jeff Escalante jescalan

View GitHub Profile

"A beginning programmer writes her programs like an ant builds her hill, one piece at a time, without thought for the bigger structure. Her programs will be like loose sand. They may stand for a while, but growing too big they fall apart.

Realizing this problem, the programmer will start to spend a lot of time thinking about structure. Her programs will be rigidly structured, like rock sculptures. They are solid, but when they must change, violence must be done to them.

The master programmer knows when to apply structure and when to leave things in their simple form. Her programs are like clay, solid yet malleable."

-- Master Yuan-Ma, The Book of Programming

@jescalan
jescalan / setup.sh
Created April 6, 2012 20:56
Environment Setup
#!/bin/sh
# --------------------------------------------------------------------------------------
# Sets up your computer with the tools you need to develop in a modern ruby environment.
# --------------------------------------------------------------------------------------
# This install includes:
# - homebrew
# - rbenv
# - ruby-build
# - ruby 1.9.3-p125
@jescalan
jescalan / github-commits.md
Last active November 30, 2022 04:48
Github commit best practice

Github Commit Security

Within github, there are two things you can do to make your commits more secure both for you and for others you work with: signing your commits, and ensuring that your personal email remains private in your commits. In this piece, We'll go over each of these methods, why they are important, and how to accomplish them smoothly on Mac OSX.

Commit Signing

Anyone who has access to a repository can push a commit to that repo under your name, and nobody will be able to tell the difference. All they have to do is change their git settings to use your name and email address for commits. Let that sink in for a minute, or if it helps more, read this piece explaining how it can turn into a serious problem. The way you can solve this problem is through signing your commits with a GPG key - when you do this, github will display a "verified" badge next to each commit. You can even set up repos so t

@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
#!/bin/sh
# Installation instructions:
# - Download the file
# - mv finalize.sh finalize
# - chmod +x finalize
# - mv finalize /usr/local/bin
# - now you can type `finalize` in any directory and it should work
# NOTE: this will rename all the files in your current directory, so be careful
@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 / browser-support-table.md
Last active March 13, 2020 22:32 — forked from danbovey/browser-support-table.md
Browser support table in markdown

Table

Chrome Firefox Opera Safari IE
Latest Latest Latest Latest 11+

Code

![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_24x24.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_24x24.png) | ![IE](https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_24x24.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_24x24.png) | ![
@jescalan
jescalan / transform.js
Created January 13, 2020 15:58
A small babel transform to switch `getStaticProps` to `getServerProps` in nextjs
// getStaticProps, which we use as the primary method for data fetching on all our pages,
// runs at build time and generates page data statically. this data is not regenerated
// unless the site is rebuilt, a lot like a static site generator. therefore, it's not
// helpful when you are trying to live preview content changes without rebuilding the entire
// site, even though its great for performance in production.
//
// In order to solve this, we run this script before pushing the preview version of the website,
// which replaces `getStaticProps` with `getServerProps`, a method with the same signature that
// dynamically fetches data fresh on every page load, making it excellent for fast-changing data,
// which is just what we need for a preview environment.
@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 / index.md
Last active May 8, 2017 18:25
Spike v1 Migration Guide

Spike v1 Migration Guide

Spike v1 represents a significant change, mostly because it includes an update from webpack v1 to webpack v2 behind the scenes. The aim of this piece is to guide you through the process of migration from one version to the next, and explain a bit of the rationale behind these changes.

App.js Updates

The bulk of the migration work lies in the app.js file. Webpack drastically changed its configuration in a very breaking manner between v1 and v2, so spike was forced to do the same, since spike is an extension of webpack.

Webpack Config Changes