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
app.get(function(req, res) => { | |
post.findById(req.params.postId) { | |
res.json(post); | |
} | |
}); | |
app.get( "/posts/:postId", ( req: any, res ) => { | |
post.findById(req.params.postId) { | |
res.json(post); | |
} |
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 MessagePolicy < ApplicationPolicy | |
def create? | |
return true if user.admin? | |
user.rooms.inlcude?(record.room) | |
end | |
def show? | |
return true if user.admin? | |
user.rooms.inlcude?(record.room) | |
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
package Shutterstock::WWW::Controller::LightboxShow; | |
use Moose; | |
extends 'Shutterstock::WWW::Controller::Base'; | |
with 'Shutterstock::WWW::Controller::Role::CheckMasonAutologout'; | |
with 'Shutterstock::WWW::Controller::Role::Dispatcher'; | |
with 'Shutterstock::WWW::Controller::Role::EnsureMasonLogin'; | |
with 'Shutterstock::WWW::Controller::Role::GlobalPageData'; | |
with 'Shutterstock::WWW::Controller::Role::Impersonator'; | |
use Shutterstock::WWW::Model::Service::Customer::Lightbox; |
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
# Failed test 'get: got expected redirect url' | |
# at t/unit/lib/Shutterstock/WWW/Controller/LightboxShow/basic.t line 40. | |
# 'http://www.jonathan.dev.shutterstock.com/login.mhtml?landing_page=%2Flightboxes%2F%3Alightbox_id' | |
# doesn't match '(?^:\/login\.mhtml\?landing_page\=\/lightboxes\/12345$)' | |
# Looks like you failed 1 test of 1. | |
not ok 3 - Ensure that dancer redirects to mason login if no logged in user is found in session | |
# Failed test 'Ensure that dancer redirects to mason login if no logged in user is found in session' | |
# at t/unit/lib/Shutterstock/WWW/Controller/LightboxShow/basic.t line 42. | |
1..1 |
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
equire 'celluloid' | |
require 'date' | |
require 'pieces' | |
class Summer | |
include Celluloid | |
attr_reader :result, :status | |
def initialize |
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
require 'parallel' | |
require 'date' | |
require './pieces' # adds pieces function to Array objects | |
@things = [] | |
100_000.times do |i| | |
@things << { name: i.to_s, value: i } | |
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 Array | |
def pieces( count ) | |
indexes = self.piece_indexes( count ) | |
indexes.map{ |index| self[*index] } | |
end | |
def piece_indexes( pieces_count ) | |
chunk_size = self.size / pieces_count | |
chunk_size = 1 if chunk_size < 1 |
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
post '/play_list/?' do | |
puts params.inspect | |
id = very_clean( params[:_id] ) | |
# validations | |
raise "Id cannot be blank" if id.nil? | |
raise "Id cannot be blank" if id.empty? | |
raise "Id must be a String" unless id.is_a? String | |
raise "That play list already exists" if find_play_list( id ) |
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
message_type=ORDER_CREATED&message_description=New%20order%20created×tamp=2011-12-30%2014%3a20%3a18&message_id=8573&vendor_id=1637811&invoice_id=4601636788&recurring=0&invoice_status=pending&invoice_list_amount=84.00&invoice_usd_amount=84.00&invoice_cust_amount=84.00&auth_exp=2012-01-05&list_currency=USD&cust_currency=USD&payment_type=paypal%20ec&sale_id=4601636779&sale_date_placed=2011-12-29%2011%3a06%3a12&customer_ip=115.132.61.12&customer_ip_country=Malaysia&customer_first_name=Maryam&customer_last_name=Bello&customer_name=Maryam%20%20Bello&customer_email=maryamsecured%40yahoo.com&customer_phone=0142601872&ship_status=shipped&ship_name=&ship_street_address=&ship_city=&ship_state=&ship_postal_code=&bill_street_address=statiestraat%2028&bill_city=Nijlen&bill_state=XX&bill_postal_code=2560&bill_country=BEL&item_count=0&md5_hash=DE5F23CC881E0370A9EFF9EA3A8AF849&key_count=44 |
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 User | |
include ReUser | |
roles do | |
role :god, :actions => [ :manage_all, :new_user_session, :destroy_user_session ] | |
role :registrant, :read_event | |
role :observer, :read_event | |
role :admin, :manage_event | |
mail_actions = [ :show_user, :read_todo, :box_mail, :show_mail ] |
NewerOlder