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
// Based off an example from node-imap, will output a list of email addresses from your | |
// gmail sent folder (so you can copy/paste to the BCC field and let people know your | |
// sorry for using the same password all over the internet resulting in your buddies | |
// getting a lame spam message) | |
var ImapConnection = require('imap').ImapConnection, | |
imap = new ImapConnection({ | |
username: '{{replace}}@gmail.com', | |
password: '{{replace}}', | |
host: 'imap.gmail.com', |
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
If you ever run across this error again: | |
uninitialized constant Psych::Syck (NameError) | |
sudo gem update --system | |
IS NOT THE FULL ANSWER DUDE. Although it appears to work, worse problems lie ahead. The real cure is downloading/installing libyaml and re-installing ruby. Atleast that solved my hell. | |
$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz | |
$ tar xzvf yaml-0.1.4.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
// Don't care much about inheritance at this point, but I'll probably attempt it at | |
// some point via cloning ancestor schema's | |
var mongoose = require('mongoose'), | |
Schema = mongoose.Schema; | |
var Contact = new Schema({ | |
_type: String, | |
name: String | |
}); |
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
# Objective: An association using STI should only query the db once for the base class | |
class Contact < ActiveRecord::Base | |
has_many :info, :class_name=>'::Contact::ContactInfo' | |
has_many :phones, :class_name=>'::Contact::Phone' | |
has_many :emails, :class_name=>'::Contact::Email' | |
has_many :addresses, :class_name=>'::Contact::Address' | |
# load all info's thorugh info | |
# this is possible due to how associations are mixed into the class via a module |
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 dbo.contacts(account_id integer, user_id text, sync text) RETURNS text AS $$ | |
if (typeof DBO !== 'function') executeSql('SELECT dbo.init();'); | |
var Contacts = DBO.Contacts || DBO.extend('Contacts',{ | |
stiContact: function stiContact(contact) { | |
if (contact.type === 'company') { | |
delete contact.first_name; | |
delete contact.last_name; | |
delete contact.title; |
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, \ |
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
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
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
1) see re: increasing shmmax http://stackoverflow.com/a/10629164/1283020 | |
2) add to postgresql.conf: | |
shared_preload_libraries = 'pg_stat_statements' # (change requires restart) | |
136 pg_stat_statements.max = 1000 | |
137 pg_stat_statements.track = all | |
3) restart postgres | |
4) check it out in psql |