Skip to content

Instantly share code, notes, and snippets.


Niraj Shukla shklnrj

Block or report user

Report or block shklnrj

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
View stripe_all_charges.rb
require "stripe"
Stripe.api_key = "YOUR_API_KEY"
def grab_and_process_charges(list_of_charges)
# complete the task that you need to do with your list of charges
list_of_charges.each do |charge|
puts "charge id is #{charge['id']} and the amount is #{charge['amount']} in currency #{charge['currency']}"
list_of_charges = Stripe::Charge.list(limit: 10)
View Display the video
<video id="into-video" class="video-js vjs-default-skin" autoplay controls preload="auto" width="640"
<source src="" type='video/webm' />
<source src="" type='video/mp4' />
<p class="vjs-no-js">To view this video please enable JavaScript, or consider upgrading your browser.</p>
shklnrj / 1. ELK.install
Created Jan 18, 2018 — forked from PavelBezpalov/1. ELK.install
ELK Stack with Rails (Elasticsearch, Logstash, Kibana) on Ubuntu VPS
View 1. ELK.install
$ sudo apt-get update && sudo apt-get install default-jre
$ wget -qO - | sudo apt-key add -
$ echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
$ sudo apt-get update && sudo apt-get install elasticsearch
$ sudo update-rc.d elasticsearch defaults 95 10
$ sudo service elasticsearch restart
$ sudo service elasticsearch status
shklnrj / nginx-config-rails4-with-puma-ssl-version.conf
Created Jan 17, 2018 — forked from rkjha/nginx-config-rails4-with-puma-ssl-version.conf
Nginx config for rails 4 application using puma [ssl and non-ssl version]
View nginx-config-rails4-with-puma-ssl-version.conf
upstream myapp_puma {
server unix:/tmp/myapp_puma.sock fail_timeout=0;
# for redirecting to https version of the site
server {
listen 80;
rewrite ^(.*) https://$host$1 permanent;
View headless
source ''
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>='
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
gem 'sidekiq'
gem 'detect_timezone_rails'
# Use Puma as the app server
View flatten.rb
def flatten(input)
result =
input.each do |element|
if element && element.instance_of?(Array)
# if the current element is an array then recursively flatten that
# array and add that array to the result
result = result+flatten(element)
# else this is just a regular element and add the element to result
result << element
You can’t perform that action at this time.