Skip to content

Instantly share code, notes, and snippets.

View antillas21's full-sized avatar

Antonio Antillon antillas21

  • Mexicali, Mexico
View GitHub Profile
@aalvarado
aalvarado / .psqlrc
Last active August 29, 2015 14:03
postgresql DEVELOPMENT configuration
\pset null 'NULL'
\set HISTFILE ~/.psql_history- :HOST - :DBNAME
\set HISTSIZE 100000
\timing
\set PROMPT1 '(%n@%M:%>) [%/] > '
\set PROMPT2 ''
\encoding unicode
\timing
\pset pager always
\setenv LESS '-iMSsx2 -FX'
@TheNaoX
TheNaoX / generate_sdk_files.rb
Last active August 29, 2015 14:14
Generate unfingerprinted version of assets and uploading them to s3
class GenerateSDKFiles
FILE_NAMES = [ "application.js" ]
ONE_HOUR = 3600
def generate
Rails.logger.info "Started to sync libraries #{FILE_NAMES}"
FILE_NAMES.each do |file_name|
#!/bin/bash
SITE=$1
TYPE=$2
LUSER="favio"
GIT_USERNAME="favrik"
SITES_FOLDER="/home/favio/web"
cd $SITES_FOLDER
@antillas21
antillas21 / sites.php
Created April 16, 2012 21:23
Steps to take Drupal site out of multi-site install
<?php
$sites = array(
'sitename.com' => 'sitename.com',
// the first sitename.com in the file, refers to the url content in the browser's window,
//you may/probably should replace this with a FQDN.
// the second sitename.com appearing after '=>' is the directory name inside sites/ where
//the site files are stored.
);
@subelsky
subelsky / fetcher.rb
Created May 3, 2012 13:29
Apprentice Homework Assignment
# Two of the projects we'll be discussing are heavily dependent on code like the example below, which
# requests stock price information from Google's finance API and transforms the results into a hash
# for use in our database. This pattern shows up over and over in my projects. I always setup a separate
# codebase containing a bunch of worker" modules that just do stuff like this.
#
# I need to write a bunch more of these for a variety of data sources. My plan is to start you off
# on these, then graduate to more complex features.
#
# Here are two things for you to try:
#
@antillas21
antillas21 / gist:3724857
Created September 14, 2012 21:10
Common Media Queries - 2012
/* SOURCE: http://www.stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/ */
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use postgresql as the database for Active Record
gem 'pg'
# Use Haml for templates
gem 'haml-rails'
@antillas21
antillas21 / gist:6832001
Created October 4, 2013 20:10
Basic JS Deferred object implementation
/*
** Solution proposed by: Chad Elliott (https://www.vizify.com/thethechad)
** at StackOverflow. Link to original: http://stackoverflow.com/a/18097040
*/
function Deferred(){
this._done = [];
this._fail = [];
}
Deferred.prototype = {

I upgraded to El Capitan, with Homebrew & Ruby, and this is how I did it flawlessly.

... and Xcode and Java, etc.

Prepare

If you don't already have homebrew installed, do that first, so you don't have to deal with SIP issues. Install all Software Updates available in the Apple Menu, up to and including El Capitan.

Hardware

@sowenjub
sowenjub / gist:1033876
Created June 19, 2011 07:29
Quickly dump your heroku production database and load it locally
#!/bin/bash
# This script does the following:
# 1/ capture and download the latest backup
# 2/ load it to your local database
# 3/ run your app and open Safari
# Just replace any uppercase string with your own data
#