Skip to content

Instantly share code, notes, and snippets.

View anthonycintron's full-sized avatar

Anthony Cintron anthonycintron

View GitHub Profile
@anthonycintron
anthonycintron / restore-database.txt
Created November 26, 2015 17:02 — forked from biske/restore-database.txt
Restore database from Heroku to local environment
$ wget $(heroku pg:backups public-url -a legacy-next-staging) -O tmp/tti_legacy.dump
Remove all conections to database (for example shut down rails servers or rails console).
# From legacy project:
$ bundle exec rake db:drop db:create
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U ivanbisevac1 -d tti_development tmp/tti_legacy.dump
$ bundle exec rake db:migrate
# On roundabout project:

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@anthonycintron
anthonycintron / pagination.md
Created September 7, 2012 15:27 — forked from mislav/pagination.md
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@anthonycintron
anthonycintron / gist:3363687
Created August 15, 2012 21:06 — forked from shripadk/gist:552554
Setting up Heroku Hostname SSL with GoDaddy SSL Cert
How to setup Heroku Hostname SSL with GoDaddy SSL Certificate and Zerigo DNS
Heroku recently added an exciting new 'Hostname SSL' option. This option offers the broad compatibility of IP-based SSL, but at 1/5 the price ($20 / month at the time of this writing).
The following tutorial explains how to use Heroku's new 'Hostname SSL' option on your Heroku project. Before we begin, let's list what we're using here:
* Heroku Hostname SSL
* GoDaddy Standard SSL Certificate
* Zerigo DNS
"""
Compresses InterviewIO Plug-in
"""
def minify_plugin():
plug_in_location = 'components/Recorder\ Plug-in/interview_plugin/'
plug_in_name = 'interviewio-1.0.1b.js'
minified_plugin_name = 'interviewio-1.0.1b-min.js'
local(JAVA_LOCATION + ' -jar ' + YUI_LOCATION + ' ' + plug_in_location + plug_in_name + ' -o ' + plug_in_location + minified_plugin_name + ' --nomunge')
print("We've minified %s" % minified_plugin_name)
@anthonycintron
anthonycintron / http.py
Created March 20, 2012 13:24
Backbone & Tastypie
# -*- coding: utf-8 -*-
from tastypie.http import HttpResponse
class HttpAccepted(HttpResponse):
status_code = 202
from recorder import InterviewIO, Service, Recording, PROTOCOL, GET
service = Service(
protocol=PROTOCOL,
domain='localhost:8000',
api_version='v1',
api_format='json',
user_name='user_name',
api_key='1234567890',
request_method=GET
)
$(document).ready(function() {
iio = $('#iio-view')
.interviewIO( {
swf_path : "/static/recorder/video/swf/ResoomayVideo.swf"
}).bind('interview.onSaved', function(evt) {
console.log(evt.filename);
});
});
@anthonycintron
anthonycintron / customEvent_ex.js
Created January 5, 2011 17:42
Experimenting with JavaScript's custom event model
function EventDispatcher() {
this._listeners = {};
}
EventDispatcher.prototype = {
constructor: EventDispatcher,
addEventListener: function (type, listener) {
if ( typeof this._listeners[type] == "undefined" ) {
this._listeners[type] = [];
}
checkIn: function(uid) {
FB.api('/me/checkins', function (response) {
AVFacebook.session = response.data;
checkin_len = response.data.length;
var checkins = [];
for ( var i=0; i < checkin_len; i++ ) {
checkins.push({'checkin':response.data[i]});
}