Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Niraj Shukla shklnrj

🎯
Focusing
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']}"
end
end
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"
poster="https://mycdn.cloudfront.net/myposter.png">
<source src="https://mycdn.cloudfront.net/video.webm" type='video/webm' />
<source src="https://mycdn.cloudfront.net/video.mp4" type='video/mp4' />
<p class="vjs-no-js">To view this video please enable JavaScript, or consider upgrading your browser.</p>
</video>
@shklnrj
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
INSTALL JAVA
$ sudo apt-get update && sudo apt-get install default-jre
INSTALL ELASTIC SEARCH https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
$ wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ echo "deb https://packages.elastic.co/elasticsearch/2.x/debian 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
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 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# 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 = Array.new
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
# else this is just a regular element and add the element to result
result << element
You can’t perform that action at this time.