Skip to content

Instantly share code, notes, and snippets.

@pratik60
pratik60 / arguments.rb
Last active June 6, 2017 13:35
Testing different version of arguments
### APPROACH 1 - Current System
def perform_args_async(*args)
data = args.to_json
new_args = JSON.parse(data)
perform(*new_args)
end
def perform(a, b)
puts "This is a - #{a} and b - #{b}"
@pratik60
pratik60 / memory_leak.log
Created March 10, 2016 05:22
memory_leak_investigate
adwyzeupstream (master) λ grep -inr "rss:" log/development.log
log/development.log:190519:MEMORY[28776]: rss: 190400, live objects 841801
log/development.log:190521:MEMORY[28776]: rss: 164288, live objects 936030
log/development.log:190618:MEMORY[28776]: rss: 188816, live objects 991408
log/development.log:190619:MEMORY[28776]: rss: 160972, live objects 991451
log/development.log:190620:MEMORY[28776]: rss: 145600, live objects 991494
log/development.log:190621:MEMORY[28776]: rss: 145600, live objects 991537
log/development.log:190812:MEMORY[28776]: rss: 97032, live objects 992414
log/development.log:190813:MEMORY[28776]: rss: 97332, live objects 992657
log/development.log:190814:MEMORY[28776]: rss: 97332, live objects 992700
@pratik60
pratik60 / sidekiq.log
Created August 31, 2015 22:09
sidekiq.log
2015-08-31T21:53:31.308Z 26886 TID-5tfns WARN: Thread TID-5tfns
2015-08-31T21:53:31.508Z 26886 TID-5tfns WARN: /webapps/myapp/shared/bundle/ruby/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/cli.rb:138:in `backtrace'
/webapps/myapp/shared/bundle/ruby/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/cli.rb:138:in `block in handle_signal'
/webapps/myapp/shared/bundle/ruby/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/cli.rb:135:in `each'
/webapps/myapp/shared/bundle/ruby/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/cli.rb:135:in `handle_signal'
/webapps/myapp/shared/bundle/ruby/2.2.0/gems/sidekiq-3.4.1/lib/sidekiq/cli.rb:88:in `run'
/webapps/myapp/shared/bundle/ruby/2.2.0/gems/sidekiq-3.4.1/bin/sidekiq:8:in `<top (required)>'
/webapps/myapp/shared/bundle/ruby/2.2.0/bin/sidekiq:23:in `load'
/webapps/myapp/shared/bundle/ruby/2.2.0/bin/sidekiq:23:in `<main>'
2015-08-31T21:53:31.508Z 26886 TID-5tfns WARN: Thread TID-a6vrg
@pratik60
pratik60 / Preferences.sublime-settings
Created June 16, 2015 16:34
my preferences - pre material
{
"auto_indent": true,
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/User/SublimeLinter/Seti (SL).tmTheme",
"default_line_ending": "unix",
"detect_indentation": true,
"detect_slow_plugins": false,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
$lang = language_default('language');
$rows = db_query("select * from url_alias where source like '%taxonomy%'")->fetchAll();
$tids = db_select("taxonomy_term_data", "ttd")
->fields("ttd", array("tid", "language"))
->condition("ttd.language",$lang)->execute()->fetchAllKeyed();
$bads = array('-0','-1','-2','-3','/' . $lang);
foreach ($rows as $row) {
$flag = 1;
foreach($bads as $bad) {
@pratik60
pratik60 / Permission
Created January 7, 2015 14:33
permission mean
'use strict';
var mean = require('meanio'),
mongoose = require('mongoose'),
Variable = mongoose.model('Variable');
exports.render = function(req, res) {
var modules = [];
// Preparing angular modules list with dependencies
@pratik60
pratik60 / findNumberWithBsearch.php
Created December 7, 2014 00:41
findNumberWithBsearch
<?php
function bsearch($number, $arr, $low, $high) {
//Traditional Recursive
if ($low > $high) {
return -1;
}
$mid = floor(($low + $high)/2);
if ($arr[$mid] == $number) {
@pratik60
pratik60 / assets.json
Created November 26, 2014 16:12
assets.json
{
"core": {
"css": {
"bower_components/build/css/dist.min.css": [
"bower_components/angular-xeditable/dist/css/xeditable.css",
"bower_components/ngAnimate/ng-animation.css",
"bower_components/ment.io/ment.io/style.css",
"bower_components/Jcrop/css/jquery.Jcrop.css",
"bower_components/jWindowCrop/jWindowCrop.css",
"bower_components/fullcalendar/fullcalendar.css",
@pratik60
pratik60 / bootstrap.css
Created November 21, 2014 09:36
boostrap.css
/*!
* Bootstrap v3.1.1 (http://getbootstrap.com)
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.0 | MIT License | git.io/normalize */
html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
@pratik60
pratik60 / bookmarker.sh
Created November 14, 2014 13:55
bookmarker.sh
#!/bin/sh
# Set of bash functions that allows you to bookmark folders in the command-line.
# To bookmark a folder, simply go to that folder, then bookmark it like so:
# bookmark foo
#
# The bookmark will be named "foo"
#
# When you want to get back to that folder use:
# go foo