Skip to content

Instantly share code, notes, and snippets.

View mrudult's full-sized avatar
🎯
Focusing

Mrudul Tarwatkar mrudult

🎯
Focusing
  • 99minds Inc
  • New York, USA
View GitHub Profile
@LeZuse
LeZuse / stats_logger.rb
Last active June 21, 2021 13:53
Puma plugin for stats logging on Heroku
Puma::Plugin.create do
def production?
ENV.fetch('RACK_ENV', 'development') == 'production'
end
def log(msg)
if production?
Rails.logger.info msg
else
puts msg
@wbotelhos
wbotelhos / clear-sidekiq-jobs.sh
Last active June 13, 2024 22:47
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
@nbhartiya
nbhartiya / javascript-widget-payload.js.coffee
Created March 25, 2015 22:07
Javascript Widget Payload Script
# Name your class anything you want. Here, I call it Foo.
# Note that by writing out our code in its own class, we namespace it.
class Foo
constructor: ->
# Here we just set the host to your website, but you might want to add a little variable here
# to make it www.staging.yourwebsite.com when you're in the staging environment and localhost:3000
# when you're in the development environment.
@host = "www.your-website.com"
# Makes the base of xml requests http when we are testing on localhost.
@nbhartiya
nbhartiya / javascript-widget-embedder.js
Created March 25, 2015 22:03
Javascript Widget Embedder Script
<script data-version='v1' data-client-id='clients-id' id='unique-embedder-id' type='text/javascript'>
// "data-version": It's useful to put the version of your embedder script in the "version" data
// attribute. This will enable you to more easily debug if any issues arise.
// "data-client-id": This id allows us to pull up the correct client's settings from our database.
// Each client may have different settings associated with their widget, and you can load them
// with this!
// "id": This HTML id allows us to refer to this embedder script's location. This is helpful
// if you want to inject html code in specific places in hour hosts's website or if you want to
// insert your payload script right next to this in the <head> tag.
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do