Skip to content

Instantly share code, notes, and snippets.

View jwo's full-sized avatar

Jesse Wolgamott jwo

View GitHub Profile
@jwo
jwo / tweetbox.jsx
Last active October 21, 2015 17:15
var TweetBox = React.createClass({
getInitialState(){
return {remaining: 140}
},
handleKeyUp() {
var text = this.refs.tweettweet.getDOMNode().value;
this.setState({remaining: (140 - text.length)});
},
render() {
return <div className="tweetbox">
{
"pizza": [
"https://upload.wikimedia.org/wikipedia/commons/1/1a/KS_pepperoni_pizza.JPG",
"https://upload.wikimedia.org/wikipedia/commons/d/d1/Pepperoni_pizza.jpg",
"http://www.daroberto.nl/wp-content/uploads/2013/03/pizza.jpg"
]
}
{
"pancakes": [
"http://media.gizmodo.co.uk/wp-content/uploads/2013/02/pancakes.jpg",
"http://i.huffpost.com/gen/1650799/images/o-PANCAKE-facebook.jpg",
"http://imparteretete.reginele.ro/wp-content/uploads/2013/06/clatite-americane.jpg",
"http://cdn.images.express.co.uk/img/dynamic/1/590x/pancakes-yum-376875.jpg",
"http://cooking-bg.com/wp-content/uploads/2013/12/pancakes.jpg",
"http://www.taste.com.au/images/recipes/agt/2003/02/12897_l.jpg"
]
}
@jwo
jwo / 0-gallery-serializer.js
Last active August 29, 2015 14:24
Ember Data 1.13 serializer; enable when server gives data in slightly wrong way
@jwo
jwo / blocks.rb
Created June 28, 2015 15:41
procs, lambda, and blocks
require 'active_support/all'
### We can send in a proc (or a lambda) for the method to call when we want it
### to run. the proc behaves like a normal argument
$array = %w(apple banana kumquat)
def titlize_fruits(proc)
proc.call $array.pop
proc.call $array.pop
@jwo
jwo / contacts.go
Last active August 29, 2015 14:23
Sample Go that will serve some data, in a postgres table, as JSON the way Ember Data wants.
package main
import (
"database/sql"
"github.com/ant0ine/go-json-rest/rest"
_ "github.com/lib/pq"
"log"
"net/http"
)
var timer = setTimeout("contentRefresh()", 1000 * 60 * 5);function contentRefresh(){self.location.reload(true)}
@jwo
jwo / Vagrantfile
Created May 4, 2015 19:18
default vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# Assign "Hello World" to a variable message
# Assign a different string to a different variable
# Assign a number to a variable
# Use string interpolation to display the number in a string
# string interpolation = "#{}"
# Make an array of your favorite movies or books or bands. Have at least 4 values.
@jwo
jwo / day-1.rb
Last active August 29, 2015 14:20
# Assign "Hello World" to a variable message
yolo = "Hello World"
# Assign a different string to a different variable
# Assign a number to a variable
# Use string interpolation to display the number in a string
# string interpolation = "#{}"