Skip to content

Instantly share code, notes, and snippets.

View pctj101's full-sized avatar

pctj101

  • Earth
View GitHub Profile
@pctj101
pctj101 / Xcode4TestFlightintegration.sh
Created November 3, 2011 20:45 — forked from incanus/Xcode4TestFlightintegration.sh
Xcode 4 scheme Archive step Post-script for automatic TestFlight build uploading. See the blog post here: http://developmentseed.org/blog/2011/sep/02/automating-development-uploads-testflight-xcode
#!/bin/bash
#
# (Above line comes out when placing in Xcode scheme)
#
API_TOKEN=<TestFlight API token here>
TEAM_TOKEN=<TestFlight team token here>
SIGNING_IDENTITY="iPhone Distribution: Development Seed"
PROVISIONING_PROFILE="${HOME}/Library/MobileDevice/Provisioning Profiles/MapBox Ad Hoc.mobileprovision"
#LOG="/tmp/testflight.log"
@pctj101
pctj101 / gist:2728171
Created May 18, 2012 23:40
Nested meteor templates w/ parent reference
<template name='reservation'>
{{#each venues}}
{{> venue}}
{{/each}}
</template>
<template name='venue'>
<div class='venue'>
{{bambam reservation}}
@pctj101
pctj101 / glacier_test.rb
Created September 5, 2012 15:23
Fog Glacier Test
require "rubygems"
require "bundler/setup"
# require your gems as usual
require "fog"
require 'fog/aws/glacier'
aws_access_key_id = "??"
@pctj101
pctj101 / resque-recovery.sh
Created October 1, 2012 05:11 — forked from invalidusrname/resque-recovery.sh
Resque: automatically kill stuck workers and retry failed jobs
#!/bin/bash
set -e
TIMEOUT_PERIOD=600
EMAIL_ADDRESS="your@email.com"
# Updated to make use of timeout and email variables
# Also see: http://vitobotta.com/resque-automatically-kill-stuck-workers-retry-failed-jobs/
@pctj101
pctj101 / devise.rb
Created December 15, 2013 11:07 — forked from nicalpi/devise.rb
# initializers/devise.rb
config.omniauth :facebook, [APP_ID], [APP_SECRET]
config.omniauth :facebook_app1, [APP_ID], [APP_SECRET], :iframe => true, :scope => 'publish_stream,offline_access,email'
config.omniauth :facebook_app2, [APP_ID], [APP_SECRET], :iframe => true, :scope => 'publish_stream,offline_access,email'
define( ['jquery'], function ( $ ) {
var token = $( 'meta[name="csrf-token"]' ).attr( 'content' );
$.ajaxSetup( {
beforeSend: function ( xhr ) {
xhr.setRequestHeader( 'X-CSRF-Token', token );
}
});
return token;
@pctj101
pctj101 / index.html
Created February 21, 2014 08:52 — forked from enjalot/index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
@pctj101
pctj101 / Gemfile
Created May 8, 2014 09:21 — forked from bf4/Gemfile
gem 'lograge' # more readable logs
gem 'logstash-event' # for logstash json format
gem 'mono_logger' # threadsafe logging
This is an example how to perform multi-select faceting in ElasticSearch.
Selecting multiple values from the same facet will result in an OR filter between each of the values:
(facet1.value1 OR facet1.value2)
Faceting on more than one facet will result in an AND filter between each facet:
(facet1.value1 OR facet1.value2) AND (facet2.value1)
I have chosen to update the counts for each facet the selected value DOES NOT belong to since we are performing an AND between each facet. I have included an example that shows how to keep the counts if you don't want to do this (filter0.sh).
# An example of using ngram analysis in ElasticSearch with the Tire rubygem
# ==========================================================================
# The original, raw example: https://gist.github.com/988923
require 'rubygems'
require 'tire'
require 'yajl/json_gem'
class URL
def initialize(attributes={})