Skip to content

Instantly share code, notes, and snippets.

View apinstein's full-sized avatar

Alan Pinstein apinstein

  • Atlanta, GA
View GitHub Profile
virtualtour=> \d+ tour_event
Table "public.tour_event"
Column | Type | Modifiers | Storage | Stats target | Description
--------------------+-----------------------------+-----------------------------------------------------------------------------------+----------+--------------+-------------
tour_event_id | integer | not null default nextval(('public.tour_event_tour_event_id_seq'::text)::regclass) | plain | |
tour_event_type_id | integer | not null | plain | |
tour_id | integer | not null | plain | |
visitor_id | text |
@apinstein
apinstein / gist:6d69438df97f50e37cfa
Created December 25, 2014 05:31
Swift Promise example
// Example of a promise that could be used to wrap bracketed capture
import Foundation
import BrightFutures
func grabBrackets (n:Int) -> Future<[AnyObject]> {
let promise = Promise<[AnyObject]>()
var data = [AnyObject]()
@apinstein
apinstein / gist:92865ce7d479b50a2726
Created December 4, 2014 17:25
migrate php file sessions to dynamo
<?php
require 'conf/webapp.conf';
$sessionTableName = '';
$sessionLifetime = ini_get('session.gc_maxlifetime');
$sdir = '/opt/www/domains/tourbuzz/runtime/sessions'; // hard-code so it still works after switching live to dynamo
$awsKey = '';
$awsSecretKey = '';
@apinstein
apinstein / gist:a2f1568863582e462239
Last active August 29, 2015 14:06
php shutdown hook to generate curl request of the current request
<?php
register_shutdown_function(function() {
$f = '/tmp/last-request-' . microtime(true) . '.sh';
$rawData = json_decode(file_get_contents("php://input"));
$url = $_SERVER['REDIRECT_SCRIPT_URI'];
$requestData = http_build_query($_REQUEST);
$postData = NULL;
@apinstein
apinstein / gist:a2620b2c4feeddf9cbe3
Created August 8, 2014 00:49
How to programmatically install all vundle plugins
vim '+set nomore' +BundleInstall! +BundleClean +qa
# nomore prevents the pager from getting hung at the "-- More --" prompt.
$sc = ShellCommand::create()
->addCommand("echo HI")
;
$j = new RemoteShellCommandJob($sc);
$j->webhookThen(
array('MyPromiseHandler', 'success'),
array('MyPromiseHandler', 'error'),
array('MyPromiseHandler', 'notify')
);
@apinstein
apinstein / gist:8329337
Created January 9, 2014 04:15
trying to get iterm2 + vim + screen clipboard integration
# iterm escape code to allow clipboard integration
https://code.google.com/p/iterm2/wiki/ProprietaryEscapeCodes
# do this in a non-screen terminal, it works!
printf "\e]50;CopyToClipboard\a...followed by text followed by...\e]50;EndCopy\a" && echo && echo 'clip...' && pbpaste
# problems
1. vim --version
-> -clipboard -xterm_clipboard
2. passing thru escape sequence in screen. maybe via termcap? or some other "carve out" for that escape sequence?
@apinstein
apinstein / gist:7093453
Last active December 26, 2015 04:29
Composer problem with github fork with an error message like: The requested package propel/propel1 dev-alans-propel-1.6.7.1-fork could not be found Ensure that the *master* branch of your fork is up-to-date with the remote since composer looks your fork's master:composer.json to determine the package name.
my apps' composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/apinstein/Propel"
}
],
"require": {
"swiftmailer/swiftmailer": "v5.0.2",
@apinstein
apinstein / gist:7001494
Created October 16, 2013 01:56
run zsh without consulting any startups files
#!/bin/zsh -f
echo yay!
@apinstein
apinstein / gist:6858299
Last active December 24, 2015 20:29
AngularJS: how to do Ember-style computed properties in angular
// do it live: http://jsfiddle.net/apinstein/2kR2c/1/
// in DOM
<div ng-controller="MyCtrl">
<p ng-click="bumpA()">a: {{a}}</p>
<p ng-click="bumpB()">b: {{b}}</p>
<p>a^2 = {{aSquared}}</p>
<p>a + b = {{aPlusB}}</p>
</div>