Skip to content

Instantly share code, notes, and snippets.

Jordan Boesch jboesch

Block or report user

Report or block jboesch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Gruntfile.js
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
uglify: {
build: {
files: {
'jquery.timeAutocomplete.min.js': ['src/*.js']
}
}
@jboesch
jboesch / pg_import_csv_to_heroku.sh
Last active Mar 28, 2019
Importing a CSV dump of Postgres data into Heroku
View pg_import_csv_to_heroku.sh
# You have your csv data and it looks like so... It's in a file named "my_data.csv" and we want to import it into a table named "my_things".
"1", "Something", "0.50", "2013-05-05 10:00:00"
"2", "Another thing", "1.50", "2013-06-05 10:30:00"
# Now you want to import it, go to the command line and type:
$ PGPASSWORD=PWHERE psql -h HOSTHERE -U USERHERE DBNAMEHERE -c "\copy my_things FROM 'my_data.csv' WITH CSV;"
# Voila! It's impoted. Now if you want to wipe it out and import a fresh one, you would do this:
@jboesch
jboesch / websocket-ruby.rb
Created Jun 4, 2012
WebSocket server in Ruby
View websocket-ruby.rb
# You need to first download em-websocket at https://github.com/igrigorik/em-websocket
# Then install the gem then name this file to "server.rb" and run it: "ruby server.rb"
# This is a combination of code from the example at http://www.igvita.com/2009/12/22/ruby-websockets-tcp-for-the-browser/
# and at http://jessedearing.com/nodes/4-pubsubbin-with-redis-eventmachine-and-websockets to publish to all connected sockets.
require 'em-websocket'
SOCKETS = []
EventMachine::WebSocket.start(:host => "127.0.0.1", :port => 8080) do |ws|
@jboesch
jboesch / gist:2289031
Created Apr 3, 2012
Detect Sencha Touch supported phone
View gist:2289031
/**
* Are we running a sencha touch supported phone? Needed
* primarily for login page
* Sencha supports: iPhone, iPod touch, Android, Blackberry 6+
*/
var isSenchaTouchSupportedPhone = function()
{
var ua = navigator.userAgent;
var supported = (
@jboesch
jboesch / gist:2255972
Created Mar 30, 2012
Get favorite tracked in an array from 8tracks
View gist:2255972
// 1. Goto 8tracks.com and login.
// 2. Under your profile click "Favorited tracks".
// 3. Open up the console (CMD+OPTION+I) in Chrome or Safari and input this:
var music=[];$('.track_info').each(function(){ music.push($.trim($(this).find('.a').text()) + ' - ' + $.trim($(this).find('.t').text())) });music.join("\n");
// 4. Then hit enter.
// You will get a list of your music that you can copy/paste somewhere else.
@jboesch
jboesch / compass.sh
Created Mar 20, 2012
Allow multiple compass projects to be "watched"
View compass.sh
#!/bin/bash
# This will run compass watchers as background tasks. When you hit CTRL+C, you don't actually
# exit out of them, they're still running. To kill all the watchers, type ./compass kill
# See usage below.
# Usage:
# Put this shell file (compass) in your compass project directory (same directory as config.rb), then navigate to it
# on the command line and type either of the commands below.
# To run, just type ./compass
@jboesch
jboesch / gravatar_import.php
Created Mar 17, 2012
Import gravatar images to store on your local server
View gravatar_import.php
<?php
set_time_limit(120);
$domains = ClassRegistry::init('Domain')->find('all', array(
'conditions' => array(
'url' => $_GET['domain']
//'paid_recurring' => 1
),
'recursive' => -1
));
@jboesch
jboesch / gist:1821407
Created Feb 13, 2012
cakephp 2.0 plugin re-routing problems
View gist:1821407
<?
// routes.php
Router::connect('/animals/:action/*', array(
'plugin' => 'big',
'controller' => 'BigAnimalsController'
));
/*
* Now I navigate to /animals and I look at my action attribute on my <form> tag
* How come my $form->create(array('controller' => 'animals')); call still outputs:
@jboesch
jboesch / gist:1586341
Created Jan 10, 2012
Auth problems with CakePHP 2.0 - migrating from 1.3 - 2.0
View gist:1586341
/****************************************************************
* AppController.php
*****************************************************************/
<?
/**
* Most application-wide logic should be handled here
*
*/
class AppController extends Controller
{
@jboesch
jboesch / gist:1585571
Created Jan 9, 2012
cakephp 2.0 auth problems
View gist:1585571
<?
// i login successfully with if($this->Auth->login()) but as soon as I call $this->redirect($this->Auth->redirect());
// it boots me back to the login screen.
public function beforeFilter()
{
//Deny access to everything by default, let isAuthorized decide to let them in
$this->Auth->deny("*");
// Set up auth error messages here, where they can actually be translated
You can’t perform that action at this time.