Skip to content

Instantly share code, notes, and snippets.

@mwean
mwean / gist:3805758
Created Sep 30, 2012
Class-level observers
View gist:3805758
require 'observer'
class BudgetsConsumer
def self.update(val)
puts "new value from enrollment consumer: #{val}"
end
end
class EnrollmentsConsumer
extend Observable
@mwean
mwean / gist:3808618
Created Sep 30, 2012
Examples of ConsumerPublisher
View gist:3808618
class ConsumerChangesObserver < ActiveRecord::Observer
observe :consumer, :address_record, :consumer_enrollment
def after_update(record)
ConsumerPublisher.publish_change(record)
end
end
class SomeController < FmsController
def some_action
@mwean
mwean / gist:3822941
Created Oct 2, 2012
Message-Based Callbacks
View gist:3822941
module FmsEngine
module Core
class Callbacks
class << self
# Redis or something:
CALLBACK_REGISTRY = Hash.new { |h, k| h[k] = [] }
def bind(event, klass, callback_method, facade_method)
CALLBACK_REGISTRY[event] << { klass: klass, callback_method: callback_method, facade_method: facade_method }
end
View ssh debug
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /home/runner/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to annkissam.beanstalkapp.com [50.31.156.72] port 22.
debug1: Connection established.
debug1: identity file /home/runner/.ssh/id_rsa type -1
debug1: identity file /home/runner/.ssh/id_rsa-cert type -1
debug1: identity file /home/runner/.ssh/id_dsa type -1
View accounts.md

Accounts

Create an account

POST /accounts

Input

  • account_id
@mwean
mwean / bitmap_heap_explain.sql
Last active Aug 29, 2015
Code Snippets for Adventures in Searching with Postgres - Part 1
View bitmap_heap_explain.sql
Bitmap Heap Scan on icd_codes (cost=7.63..900.68 rows=10 width=143)
Filter: ((code)::text ~~ 'A1%'::text)
-> Bitmap Index Scan on index_code_on_icd_codes (cost=0.00..7.62 rows=333 width=0)
Index Cond: (((code)::text ~>=~ 'A1'::text) AND ((code)::text ~<~ 'A2'::text))
@mwean
mwean / create_index1.sql
Last active Oct 5, 2017
Code Snippets for Adventures in Searching with Postgres - Part 2
View create_index1.sql
CREATE INDEX index_description_on_icd_codes ON icd_codes USING gin(to_tsvector(description))
View gist:dfa5410df60d5801c11b
total commits: 192
58 Merge
12 Update
12 Add
9 adds
8 Added
6 bump
6 Fix
4 Still
4 Fixed
@mwean
mwean / SassMeister-input.scss
Created Jun 3, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.13)
// Compass (v1.0.3)
// ----
map-merge((foo: 1, bar: 2), (baz: 3));
map-merge(("foo": 1), ("bar": 2));
@mwean
mwean / SassMeister-input.scss
Last active Aug 29, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
$positions: (
backend: "\e83a",
dev: "\e84a",
data: "\e82e",
front: "\e807",