Skip to content

Instantly share code, notes, and snippets.

@robflaherty
robflaherty / csv-to-json.php
Created September 1, 2011 02:26
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
$elem = $html->find('.c3');
$elem->outertext = '<strong>' . $elem->outertext . '</strong>';
@robflaherty
robflaherty / gist:1153058
Created August 18, 2011 01:09
concatenate js with php example
<?php
header('Content-type: application/javascript');
$files = array(
//Plugins
dirname(__FILE__) . '/plugins/jquery.hoverIntent.min.js',
dirname(__FILE__) . '/plugins/jquery.placeholder.min.js',
dirname(__FILE__) . '/plugins/jquery.form.min.js',
dirname(__FILE__) . '/plugins/jquery.tabs.min.js',
dirname(__FILE__) . '/plugins/jquery.tweet.min.js',
@robflaherty
robflaherty / gist:1129904
Created August 7, 2011 00:00
Stylus conversion of Normalize.css
/*
* Normalize.css converted to Stylus
* http://github.com/necolas/normalize.css
*/
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section
display: block
audio, canvas, video
display: inline-block
@robflaherty
robflaherty / gist:1129871
Created August 6, 2011 23:14
CoffeeScript and Stylus watch/build cakefile
# CoffeeScript and Stylus watch/build cakefile
{spawn, exec} = require 'child_process'
task 'assets:watch', 'Watch source files and build JS & CSS', (options) ->
runCommand = (name, args...) ->
proc = spawn name, args
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
proc.stdout.on 'data', (buffer) -> console.log buffer.toString()
proc.on 'exit', (status) -> process.exit(1) if status isnt 0
var app = (function(testMode) {
//Private methods
var method1 = function() {};
var method2 = function() {};
//Public methods
var method3 = function() {};
var method4 = function() {};
@robflaherty
robflaherty / LICENSE
Created June 18, 2011 15:31 — forked from hugs/LICENSE
The Node.js "Hello World" web server ported to CoffeeScript
I, Jason Huggins, the author of the work "CoffeeScript Web Server" (2010), irrevocably renounce
all current and future legal rights to the work in any medium whatsoever.
I stand behind the merit of the work, but disclaim all liability for it under law.
I encourage you, the audience, to share, copy, distribute, perform, remix, mash up, interpret,
excerpt, translate, and otherwise enjoy and use the work as you will.
I request that you acknowledge my authorship.
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
<!--[if lt IE 9]><script src="/_assets/js/html5-shiv.js"></script><![endif]-->
<link rel="stylesheet" href="/_assets/css/styles.css" media="all" />
<!--[if IE]><link rel="stylesheet" href="/_assets/css/ie.css" media="all" /><![endif]-->
//Set initial slide
changeSlide(currentSlide);
//Add this line to make the slides auto-change
autoSlide = setInterval(function() { nextSlide() }, 30000);
@robflaherty
robflaherty / cookie.js
Created January 29, 2011 23:13
standalone utility for getting/setting/deleting cookies