Skip to content

Instantly share code, notes, and snippets.

View toamitkumar's full-sized avatar
🏠
Working from home

Amit Kumar toamitkumar

🏠
Working from home
View GitHub Profile
@toamitkumar
toamitkumar / output.log
Created February 26, 2019 10:16
alicloud_db_instance_error.log
2019/02/26 18:15:19 [TRACE] vertex 'root.alicloud_db_instance.default': evaluating
2019/02/26 18:15:19 [TRACE] [walkValidate] Entering eval tree: alicloud_db_instance.default
2019/02/26 18:15:19 [TRACE] root: eval: *terraform.EvalSequence
2019/02/26 18:15:19 [TRACE] root: eval: *terraform.EvalValidateResourceSelfRef
2019/02/26 18:15:19 [TRACE] root: eval: *terraform.EvalGetProvider
2019/02/26 18:15:19 [TRACE] root: eval: *terraform.EvalInterpolate
2019/02/26 18:15:19 [TRACE] root: eval: *terraform.EvalValidateResource
2019/02/26 18:15:19 [TRACE] [walkValidate] Exiting eval tree: alicloud_db_instance.default
2019/02/26 18:15:19 [TRACE] dag/walk: walking "provider.alicloud (close)"
2019/02/26 18:15:19 [TRACE] vertex 'root.provider.alicloud (close)': walking
location ~ /api/v1/cards/(\w+)/(\w+) {
if ($request_method = OPTIONS ) {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Cache-Control,Content-Type,If-Modified-Since';
return 204;
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Cache-Control,Content-Type,If-Modified-Since';
@toamitkumar
toamitkumar / gist:952211
Created May 2, 2011 19:35
Inspect and test routes on console (Rails 3)
$ rails console
Loading development environment (Rails 3.0.6)
ruby-1.8.7-p334 :001 > r = Rails.application.routes
Gives you a handle of all the routes (config/routes.rb)
#Inspect a named route:
ruby-1.8.7-p334 :005 > r.recognize_path(app.destroy_user_session_path)
=> {:action=>"destroy", :controller=>"sessions"}
// TEST
lab.test('it returns 500 error on failure', function (done) {
scope = nock(nockUrl)
.get('/some/endpoint')
.reply(500);
request = {
method: 'GET',
url: '/some/endpoint
NSDecimal newPoint[2];
new_point = Pointer.new(NSDecimal.type, 2)
NSDecimalRound(&newPoint[0], &newPoint[0], 0, NSRoundPlain);
NSDecimalRound(new_point, new_point, 0, NSRoundPlain)
int x = [[NSDecimalNumber decimalNumberWithDecimal:newPoint[0]] intValue];
@toamitkumar
toamitkumar / REPL
Created November 10, 2012 05:57 — forked from naoyamakino/REPL
using NanoStore::Model to do basic relations.
(main)> bag = NanoStore::Bag.bag
=> #<NanoStore::Bag:0x8c930b0>
(main)> NanoStore.shared_store.addObject(bag, error:nil)
=> true
(main)> bag.setName "cars"
=> #<NanoStore::Bag:0x8c930b0>
(main)> user = User.create(8, 'demo', 23, bag.name)
=> #<User:0x8c93800>
(main)> user.save
=> #<User:0x8c93800>
@toamitkumar
toamitkumar / gist:3852022
Created October 8, 2012 11:25
open_range
class OpenEndedRange
attr_reader :first, :last
def initialize(first, last, exists = {})
exists = { first => true, last => true }.merge(exists)
@first, @last, @first_exists, @last_exists = first, last, exists[:first], exists[:last]
end
def first_exists?
@first_exists
require 'active_support/dependencies'
module ActiveSupport::Dependencies
alias_method :require_or_load_without_multiple, :require_or_load
def require_or_load(file_name, const_path = nil)
if file_name.starts_with?(Rails.root.to_s + '/app')
relative_name = file_name.gsub(Rails.root.to_s, '')
@engine_paths ||= Rails::Application::Railties.engines.collect{|engine| engine.config.root.to_s }
@engine_paths.each do |path|
engine_file = File.join(path, relative_name)
require_or_load_without_multiple(engine_file, const_path) if File.file?(engine_file)
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = ExampleViewController.alloc.init
@window.makeKeyAndVisible
true
end
end
@toamitkumar
toamitkumar / gist:3038214
Created July 3, 2012 07:13
testing rubymotion
it 'should perform a long running operation' do
@ary.performSelector("addObject:", withObject:"soup", afterDelay:0.5)
wait 0.6 do
@ary.size.should.be 1
end
end