This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Roberto Url is a tiny url. It depends on the cross-language hashids lib http://www.hashids.org/ | |
class RobertoUrlController < ApplicationController | |
layout false | |
# cursory glance at the code, this appears to be threadsafe | |
HASHER = ::Hashids.new("no offense rob, this is a tribute to your carb intake not your manhood") #change the salt and all urls are invalid! | |
PREFIX = "#{Rails.configuration.base_url}/l" | |
# note, extremely important that you do not change the keys of the object map as the | |
# hashing is tied to the sequence key: So add class maps to the end of the list! | |
# also, because classes can be models, use the string representation of the class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DAMN: THIS NO WORK because it watches the model, some how this also needs to tied | |
// into form submit for the cases where the model value was left blank | |
// for now, use this: ng-class || ng-show ="{ error: inviteForm.email.$invalid && inviteForm.email.$dirty }" | |
// Will toggle the css error class on the .control-group container and create/remove | |
// the error message. Also assumes data is not invalid in a pristine state | |
// depends on bootstrap form layout and jQuery; TODO: make work without jQuery | |
angular.module('blitUi', []).directive('showsValidation', function() { | |
return { | |
restrict: 'A', | |
link:function (scope, element, attrs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select (select array(select a.e from unnest(matches) as a(e) where a.e != '%CHAN%')) from sms_keywords; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COPY( | |
SELECT | |
p.id as "id", | |
p.payor_email as "email", | |
to_char(p.created_at,'YYYYMMDD') as "date", | |
pgroup.gross*0.01::money as "gross", | |
pgroup.refunded*0.01::money as "refunded", | |
f.name as "fund", | |
pgroup.fee*0.01::money as "fee", | |
(SELECT 'Paid') as "status", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# download and install pcre | |
# download and unpack (mine was 2.4.3) latest stable apache | |
cd httpd-2.4.3 | |
export LTFLAGS='--tag CC' | |
# might have to symlink this file if you get a toolchain error | |
# sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain | |
./configure --silent --prefix=/usr/local/ --disable-debug --disable-dependency-tracking | |
cd support | |
make -s ab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone git://github.com/v8/v8.git | |
cd ./v8 | |
git checkout remotes/origin/3.11 | |
make dependencies | |
make -j 2 library=shared x64.release | |
# not sure if this is required, also will be .so lib on linux systems | |
sudo cp ./out/x64.release/libv8.dylib /usr/lib | |
cd ../ | |
git clone https://code.google.com/p/plv8js/ | |
make && sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateAccounts < ActiveRecord::Migration | |
def up | |
#return unless connection.schema_search_path == 'public' | |
#-- create a dummy schema so migrations will run | |
execute "CREATE SCHEMA crm0;" | |
#-- citext is cool (I think) | |
execute "CREATE EXTENSION IF NOT EXISTS citext;" | |
#-- public/shared types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ICU | |
curl -O http://download.icu-project.org/files/icu4c/49.1.1/icu4c-49_1_1-src.tgz | |
tar -xzf icu4c-49_1_1-src.tgz | |
cd ./icu/source | |
./runConfigureICU MacOSX --with-library-bits=64 --disable-samples --enable-static | |
make | |
sudo make install | |
# SpiderMonkey | |
curl -O http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# sudo stop www-blit.com | |
# rm /var/www/blit/tmp/puma/* | |
# sudo start www-blit.com | |
# TODO: figure out how to restart sidekiq | |
ps auxf | grep "blit" | |
blit_puma_pid=$(ps -C ruby -F | grep '/puma.*\[blit\]' | awk {'print $2'}) | |
echo "sending SIGUSR1 to pid $blit_puma_pid" | |
kill -s SIGUSR1 $blit_puma_pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION dboBlit(account_id integer, user_id integer) RETURNS void AS $$ | |
Blit = {}; | |
Blit.DBO = (function(){ | |
// load schemas | |
var schema = {}; | |
plv8.elog(NOTICE, 'loading schema'); | |
plv8.execute("\ | |
SELECT c.relname as table, \ |