Skip to content

Instantly share code, notes, and snippets.

Amit Kumar toamitkumar

Block or report user

Report or block toamitkumar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@toamitkumar
toamitkumar / output.log
Created Feb 26, 2019
alicloud_db_instance_error.log
View output.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
View gist:814dbfc9969597a4553dc9d3a6c876c7
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';
View gist:d48f6526a5ce16f2b0c0
// 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 Aug 29, 2015
angular lazy load modules
View angular lazy load modules
angular.module('xyzApp', [
'....'
'uiGmapgoogle-maps',
'ui.bootstrap',
'duScroll',
'base64',
'angularModalService',
'oc.lazyLoad'
])
.config(['uiGmapGoogleMapApiProvider', function(uiGmapGoogleMapApiProvider) {
View gist:ebec13c4cecc064d15cf
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
View gist:afe3433b5126f3252458
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 Mar 19, 2014
Response interceptor for handling 401s
View gist:9641101
.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');
View gist:4110090
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 Nov 10, 2012 — forked from naoyamakino/REPL
using NanoStore::Model to do basic relations.
View REPL
(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>
View gist:3852022
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
You can’t perform that action at this time.