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';
// 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
@toamitkumar
toamitkumar / angular lazy load modules
Last active August 29, 2015 14:16
angular lazy load modules
angular.module('xyzApp', [
'....'
'uiGmapgoogle-maps',
'ui.bootstrap',
'duScroll',
'base64',
'angularModalService',
'oc.lazyLoad'
])
.config(['uiGmapGoogleMapApiProvider', function(uiGmapGoogleMapApiProvider) {
cp /opt/index_data/data/solr/searchdp/conf/* /data/solr/searchdp/conf/
cp /opt/index_data/data/solr/searchdp_tablet/conf/* /data/solr/searchdp_tablet/conf/
cp /opt/index_data/data/solr/searchhtl/conf/* /data/solr/searchhtl/conf/
cp /opt/index_data/data/solr/searchns/conf/* /data/solr/searchns/conf/
cp /opt/index_data/data/solr/searchsmp/conf/* /data/solr/searchsmp/conf/
cp /opt/index_data/data/solr/solr.xml /data/solr/solr.xml
function getHalResource(req, path, callback) {
var headers = {};
headers['Content-Type'] = 'application/hal+json';
var options = {
method: 'GET',
headers: headers
}
requestResource(req, path, options, callback);
@toamitkumar
toamitkumar / gist:9641101
Created March 19, 2014 12:58
Response interceptor for handling 401s
.config(function ($httpProvider) {
var logsOutUserOn401 = ['$q', '$location', function ($q, $location) {
var success = function (response) {
return response;
};
var error = function (response) {
if (response.status === 401) {
//redirect them back to login page
$location.path('/s/login');
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