This file contains hidden or 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
| var https = require('https'); | |
| var util = require('util'); | |
| var webhook = '/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'; | |
| exports.handler = function(event, context) { | |
| console.log(JSON.stringify(event, null, 2)); | |
| console.log('From SNS:', event.Records[0].Sns.Message); | |
| var postData = { | |
| "text": "*" + event.Records[0].Sns.Subject + "*" |
This file contains hidden or 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
| root = Node.create! | |
| child = Node.create!(:parent => root, :value => 12) | |
| grandchild = Node.create!(:parent => child) | |
| root.effective_value # nil | |
| child.effective_value # 12 | |
| grandchild.effective_value # 12 -- inherited from child | |
This file contains hidden or 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
| ActiveRecord::Schema.define do | |
| create_table :nodes, :force => true do |t| | |
| t.string :name | |
| t.string :value | |
| t.string :ancestry, :index => true | |
| end | |
| end | |
| class Node < ActiveRecord::Base | |
| has_ancestry |
This file contains hidden or 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
| { | |
| "Records": [ | |
| { | |
| "EventSource": "aws:sns", | |
| "EventVersion": "1.0", | |
| "EventSubscriptionArn": "arn:aws:sns:us-east-1:XXX", | |
| "Sns": { | |
| "Type": "Notification", | |
| "MessageId": "XXX", | |
| "TopicArn": "arn:aws:sns:us-east-1:XXX", |
This file contains hidden or 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
| BootstrapDialog.show({ | |
| title: 'Yo DAWG! A popup on your popup', | |
| message: function(dialog) { | |
| return $('<div>I heard you like that</div>'); | |
| }, | |
| buttons: [ | |
| { | |
| label: 'Close', | |
| cssClass: 'btn btn-default btn-sm', | |
| action: function(dialogItself){ |
This file contains hidden or 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
| BootstrapDialog.show({ | |
| title: 'Hello', | |
| message: 'I love this blog!' | |
| }); |
This file contains hidden or 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
| before 'deploy:started', "puma:phased-restart" | |
| after 'deploy:started', 'reenable_phased_restart' | |
| task :reenable_phased_restart do | |
| ::Rake.application['puma:phased-restart'].reenable | |
| end |
This file contains hidden or 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 ActiveSupport::BufferedLogger | |
| def formatter=(formatter) | |
| @log.formatter = formatter | |
| end | |
| end | |
| class Formatter | |
| SEVERITY_TO_COLOR_MAP = {'DEBUG'=>'0;37', 'INFO'=>'32', 'WARN'=>'33', 'ERROR'=>'31', 'FATAL'=>'31', 'UNKNOWN'=>'37'} | |
| def call(severity, time, progname, msg) |
This file contains hidden or 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
| ENV["RAILS_ENV"] = "test" | |
| require File.expand_path("../dummy/config/environment.rb", __FILE__) | |
| require "rails/test_help" | |
| require 'scratch' # Replace this with the name of your gem | |
| Rails.backtrace_cleaner.remove_silencers! |
This file contains hidden or 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
| ~/projects/scratch> rspec --init | |
| create spec/spec_helper.rb | |
| create .rspec | |
| ~/projects/scratch> mv test/dummy spec/ | |
| ~/projects/scratch> rm -rf test |
NewerOlder