Skip to content

Instantly share code, notes, and snippets.

View goromlagche's full-sized avatar
😴

Mrinmoy Das goromlagche

😴
View GitHub Profile
@goromlagche
goromlagche / nvm.sh
Created May 11, 2015 08:01
nvm setup
curl https://raw.githubusercontent.com/creationix/nvm/v0.12.1/install.sh | bash
nvm install 0.12.2
nvm use 0.12.2
import Data.Text (Text, map,
toLower, words, pack)
import Data.Text.IO (readFile)
import Data.Char (isLetter)
import Prelude hiding (map, words, readFile)
import Data.Map.Strict (toList, fromListWith)
import GHC.Exts (sortWith)
import Control.DeepSeq
import Control.Parallel.Strategies hiding(parMap)
#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> vi ;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
vvvi qs;
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
int countI;
int countDP;
int countKadne;
module Archivable
extend ActiveSupport::Concern
included do
default_scope -> { where(is_archived: false) }
scope :with_archived, -> { all.unscope(where: :is_archived) }
scope :only_archived, -> { with_archived.where(is_archived: true) }
end
@goromlagche
goromlagche / compile-current-cpp-java-file.el
Last active November 8, 2017 14:38
a small function to compile cpp/java code on eshell
(defun compile-current-cpp-file ()
"Compile and run current file on eshell"
(interactive)
(let ((filename (buffer-file-name)))
(with-selected-window (get-buffer-window "*eshell*")
(recenter)
(insert "g++ -std=c++11 " filename " -o a.out && ./a.out")
(eshell-send-input)
(erase-buffer))
(message "File '%s' is compiled and ran" filename)))
@goromlagche
goromlagche / batman-jl.md
Created January 25, 2018 17:32 — forked from avinassh/batman-jl.md
Batman animated and JL viewing order.

Batman animated and JL viewing order.

Canon 1:

  1. Batman: mask of Phantasm *
  2. Batman and Mr. Freeze: SubZero
  3. Batman: Mystery of Batwoman

Canon 2: If you plan to watch Justice league too then refer JL canon #2

  1. Son of Batman
  2. Batman vs Robin
@goromlagche
goromlagche / a_sample_rspec_api_concurrent_call_spec.rb
Last active October 10, 2023 05:03
A sample rspec spec to test concurrent api calls
require 'rails_helper'
describe Api::V1::CheckoutsController, type: :request do
let(:user) do
FactoryGirl.create(:user, current_balance: 100_000)
end
describe 'check concurrency' do
it 'send multiple same requests', truncation_only: true do
FactoryGirl.create(:item,
module ArHelpers
def listen_to_insert_ar_calls(table)
ActiveSupport::Notifications
.subscribe('sql.active_record') do |_, _, _, _, details|
if details[:sql] =~ /INSERT INTO `#{table}`/
@sql = details[:sql]
end
end
end
end
@goromlagche
goromlagche / Sneaker log formatter
Last active August 24, 2018 11:39
writing a generic log formatter for rails and sneakers
A very simple generic log formatter for sneakers and rails.