Skip to content

Instantly share code, notes, and snippets.

View seerahulsingh's full-sized avatar
🏠
Working from home

Rahul Singh seerahulsingh

🏠
Working from home
  • Varanasi
View GitHub Profile
@seerahulsingh
seerahulsingh / s3_folder_upload.rb
Created August 15, 2021 19:06 — forked from fleveque/s3_folder_upload.rb
Upload folder to S3 recursively with ruby, multi threads and aws-sdk v2 gem, based on http://avi.io/blog/2013/12/03/upload-folder-to-s3-recursively/
#!/usr/bin/env ruby
require 'rubygems'
require 'aws-sdk'
class S3FolderUpload
attr_reader :folder_path, :total_files, :s3_bucket, :include_folder
attr_accessor :files
# Initialize the upload class
@seerahulsingh
seerahulsingh / package.xml
Created May 26, 2021 17:12 — forked from shanerk/package.xml
Salesforce package.xml file to get all metadata from your org. Works great with vscode and cli.
<?xml version="1.0" encoding="UTF-8" ?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>ApexClass</name>
</types>
<types>
<members>*</members>
<name>ApexComponent</name>
</types>
@seerahulsingh
seerahulsingh / gist:c1a6bab85928d85c278b302a631e9e22
Created June 29, 2018 14:28 — forked from wrburgess/gist:5528649
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@seerahulsingh
seerahulsingh / application_controller.rb
Created April 27, 2018 05:47 — forked from jamesmartin/application_controller.rb
Testing ApplicationController before_filter methods using RSpec's "anonymous" controller instance
class ApplicationController < ActionControllerBase
helper :do_something
def do_something
@from_do_something = params[:for_do_something]
end
end
@seerahulsingh
seerahulsingh / rspec_model_testing_template.rb
Created February 6, 2018 16:19 — forked from PWSdelta/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@seerahulsingh
seerahulsingh / youtube-dl-download-pluralsight.md
Created January 3, 2018 17:27 — forked from munim/youtube-dl-download-pluralsight.md
youtube-dl to download pluralsight videos

Download Plural Sight videos

Software required:

youtube-dl

After installation and putting the youtube-dl in PATH

youtube-dl \
➜ .deploy git:(develop) ✗ mup deploy --settings settings.json --verbose
Building App Bundle Locally
Started TaskList: Pushing Meteor App
[104.236.50.8] - Pushing Meteor App Bundle to the Server
[104.236.50.8] - Pushing Meteor App Bundle to the Server: SUCCESS
[104.236.50.8] - Prepare Bundle
node-8.4.0-base: Pulling from abernix/meteord
Digest: sha256:04f44cf999da383d11de77027ced8b70818222c9890a405ce10803af3ee5a642
Status: Image is up to date for abernix/meteord:node-8.4.0-base
@seerahulsingh
seerahulsingh / app.js
Created July 24, 2017 19:33 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@seerahulsingh
seerahulsingh / compressed_static_assets.rb
Created July 24, 2017 10:12 — forked from guyboltonking/compressed_static_assets.rb
Slightly hacky rails middleware for serving up precompiled gzipped assets
require 'action_dispatch/middleware/static'
module Middleware
class FileHandler < ActionDispatch::FileHandler
def initialize(root, assets_path, cache_control)
@assets_path = assets_path.chomp('/') + '/'
super(root, cache_control)
end
def match?(path)
@seerahulsingh
seerahulsingh / x-editable-rails automation
Last active May 2, 2017 08:15
x-editable-rails automation
$.fn.editable.defaults.mode = 'inline';
$(".xedit").each(function () {
$(this).editable({
value: user[$(this).attr('id')],
onblur: 'submit',
showbuttons: false,
source: EmConfig.us_states_short_name.map(function (st) { # array for US state to populate select input
return { value: st, text: st };
}),
url: '/api/v1/user/update', #