Skip to content

Instantly share code, notes, and snippets.

View newsomc's full-sized avatar

Clint Newsom newsomc

View GitHub Profile
@newsomc
newsomc / validate-input-component.coffee
Created May 1, 2014 23:22
Validation of a react component.
Validate = {
getDefaultProps: ->
validate: []
hasErrors: ->
errors = []
@validate.forEach (cond) =>
if cond.test(@state.value)
errors.push(cond.message)
dom = React.DOM;
placeholder = document.createElement("li")
placeholder.className = "placeholder"
SearchItemBox = React.createClass
getInitialState: -> data: @props.data
handleItemSubmit: (item) ->
items = @state.data
dom = React.DOM;
placeholder = document.createElement("li")
placeholder.className = "placeholder"
SearchItemBox = React.createClass
getInitialState: -> data: @props.data
handleItemSubmit: (item) ->
items = @state.data
#!/bin/bash
if [[ -z $1 ]]; then
branch='test'
else
case $1 in
-b | --branch)
branch=$2
;;
--branch=*)
@newsomc
newsomc / week10.json
Created November 14, 2014 15:20
Decade Week 10
[{"name": "Who's Afraid of Detroit", "preview": {"mp3": {"offset": {"start": 145613, "end": 265613}, "url": "https://geo-samples.beatport.com/lofi/214938.LOFI.mp3"}, "mp4": {"offset": {"start": 145613, "end": 265613}, "url": "https://geo-samples.beatport.com/lofi/214938.LOFI.mp4"}}, "id": 214938, "label": {"slug": "dirtybird", "name": "dirtybird", "id": 619}, "slug": "whos-afraid-of-detroit-original-mix", "artists": [{"slug": "claude-vonstroke", "name": "Claude VonStroke", "id": 5430}], "remixers": [], "date": {"released": "2006-11-30", "published": "2006-11-30"}, "key": "C min", "mix": "Original Mix", "genres": [{"slug": "minimal", "name": "Minimal", "id": 14}], "waveform": {"dynamic": {"url": null, "id": null}, "large": {"height": 250, "url": "https://geo-media.beatport.com/image/2353917.png", "id": 2353917, "width": 1500}}, "title": "Who's Afraid of Detroit (Original Mix)", "purchase": "individual", "formats": {"wav": {"display": "$0.75", "value": 0.75, "code": "USD", "symbol": "$"}, "aiff": {"display": "$
[{"release": {"name": "Claude VonStroke EP", "slug": "claude-vonstroke-ep", "id": 38693}, "remixers": [], "mix": "Original Mix", "key": "C min", "slug": "whos-afraid-of-detroit-original-mix", "exclusive": false, "label": {"name": "dirtybird", "slug": "dirtybird", "id": 619}, "preview": {"mp4": {"offset": {"start": 145613, "end": 265613}, "url": "https://geo-samples.beatport.com/lofi/214938.LOFI.mp4"}, "mp3": {"offset": {"start": 145613, "end": 265613}, "url": "https://geo-samples.beatport.com/lofi/214938.LOFI.mp3"}}, "price": {"display": "$1.99", "value": 1.99, "code": "USD", "symbol": "$"}, "bpm": 125, "date": {"released": "2006-11-30", "published": "2006-11-30"}, "name": "Who's Afraid of Detroit", "title": "Who's Afraid of Detroit (Original Mix)", "duration": {"minutes": "6:04", "milliseconds": 364033}, "active": true, "genres": [{"name": "Minimal", "slug": "minimal", "id": 14}], "purchase": "individual", "formats": {"aiff": {"display": "$0.75", "value": 0.75, "code": "USD", "symbol": "$"}, "wav": {"display
=> "<p>TK</p>\r\n<p><a href=\"/recipes/35301-cinnamon-rolls\" target=\"_blank\">Cinnamon Rolls</a>&nbsp;by&nbsp;<a href=\"/users/3572-erinmcdowell\" target=\"_blank\">erinmcdowell</a></p>\r\n<p style=\"text-align: center;\"><a href=\"/recipes/35301-cinnamon-rolls\" target=\"_blank\"><img src=\"https://images.food52.com/RpY7QrE3N0Vl9LB8Dp1nBAExbck=/753x502/c9f564a8-2850-4d28-a8ce-3685e10b1536.17170272651_0caebeae78_b.jpg\" alt=\"\" width=\"753\" /><br /></a>\"Buns of steel.\"</p>\r\n<p style=\"text-align: center;\">&nbsp;</p>\r\n<p style=\"text-align: left;\"><a href=\"/recipes/587-poached-egg-bacon-sandwich\" target=\"_blank\">Poached Egg &amp; Bacon Sandwich</a>&nbsp;by&nbsp;<a href=\"/users/2591-pipsplate\" target=\"_blank\">pipsplate</a></p>\r\n<p style=\"text-align: center;\"><a href=\"/recipes/587-poached-egg-bacon-sandwich\" target=\"_blank\"><img src=\"https://images.food52.com/QUWOKVOxPLQ-jmL-FZpbgP0PZnU=/753x502/5710ab81-2736-4d0f-85cf-391f46f6e32a.05-28-13-egg-sandwich-007.jpg\" alt=\"\" width=\"753
Raw Log
Beginning deployment of cms (ef75f05931da73a932f835da4e668a2b97c3f048) with migration: "rake db:migrate".
(/usr/local/ey_resin/ruby/bin/gem list engineyard-serverside | grep 'engineyard-serverside ' | egrep -q '2\.6\.3[,)]') || (sudo sh -c 'cd `mktemp -d` && /usr/local/ey_resin/ruby/bin/gem install engineyard-serverside --no-rdoc --no-ri -v 2.6.3')
/usr/local/ey_resin/ruby/bin/engineyard-serverside _2.6.3_ deploy --account-name Food52 --app food52 --config '{"input_ref":"cms","deployed_by":"Clint Newsom"}' --environment-name staging --framework-env staging --git git@github.com:food52/food52.git --instance-roles ec2-184-72-248-217.compute-1.amazonaws.com:solo --instances ec2-184-72-248-217.compute-1.amazonaws.com --migrate 'rake db:migrate' --ref ef75f05931da73a932f835da4e668a2b97c3f048 --stack nginx_unicorn --verbose
+ 00s Initializing engineyard-serverside 2.6.3.
+ 00s ~> Verifying and propagating engineyard-serverside 2.6.3 to all servers.
+ 00s $ (ssh -i /home/deploy/.ssh/internal -o
<?php
if(!$_REQUEST['event_type_id'] || ($_REQUEST['event_type_id'] != 'IMAX' && $_REQUEST['event_type_id'] != "SPACESHOWS")){
//Open the db connection
db_connect();
//start building the SQL statement
$sql = "SELECT a.event_id, a.event_code, a.event_title, a.event_desc, a.event_short_desc, a.event_location, a.event_time_desc, a.event_price_data, a.event_note,
a.event_tag, a.event_img_filename, a.event_img_caption, a.event_img_credit, a.is_members_only, a.is_member_event, a.ticket_code,
a.show_buy_button, a.event_code2, a.ticket_code2, a.event_time_desc2, a.show_buy_button2, a.access_chair, a.access_audio, a.access_tty, a.access_largeprint, a.access_cc, a.access_sign, a.access_braille, a.access_touch,
b.event_img_path, b.event_type_desc, b.banner_filename, b.event_type_note,
<?php
include "/web/docs/programs/includes/functions.inc";
db_connect();
if ($_GET['event_type_id'] || $_GET['event_subtype_id'] || $_GET['event_sub_subtype_id']){
$event_type_id = $_GET['event_type_id'];
$event_subtype_id = $_GET['event_subtype_id'];