This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="person-tmpl-django" class="fix" type="text/x-jquery-tmpl"> | |
<div id="person-${user.id}" class="person"> | |
<strong>${user.name}</strong> | |
[[each(i, c) user.children]] | |
<div class="child">${c.child_name}</div> | |
[[/each]] | |
<span>${user.age}</span> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************** | |
* UPDATE: I have crated a plugin to do this: https://github.com/jboesch/jQuery-fullCalendar-iPad-drag-drop/ | |
*********************************/ | |
/*These are the brief steps that it takes to get fullCalendar (http://arshaw.com/fullcalendar/) up and running with drag/drop support on the iPad. This assumes you already have fullCalendar setup.*/ | |
//1. Include a copy of jQuery touch punch in your project, you can find it here: https://github.com/furf/jquery-ui-touch-punch | |
//2. Go into jquery-touch-punch.js and right after this line (around line 57 - mouseProto._mouseDown = function (event) {) add this: this._mouseDownEvent = event; | |
//3. Add this function somewhere in your global.js file or wherever you want: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Examples can be found here: http://boedesign.com/misc/outer_setters.html | |
// Discussed here: http://forum.jquery.com/topic/outerheight-int-sets-the-height-taking-into-account-padding-and-border | |
(function($){ | |
function _outerSetter(direction, args){ | |
var $el = $(this), | |
$sec_el = $(args[0]), | |
dir = (direction == 'Height') ? ['Top', 'Bottom'] : ['Left', 'Right'], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
uglify: { | |
build: { | |
files: { | |
'jquery.timeAutocomplete.min.js': ['src/*.js'] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get the date we just clicked on (td cell) | |
* | |
* @param {Object} $td The jQuery td element | |
*/ | |
var getDateFromTdCell = function($td) | |
{ | |
var self = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 = ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
NewerOlder