Skip to content

Instantly share code, notes, and snippets.

Avatar

Kumaresan kumaresan-rails

  • Bengaluru, India
View GitHub Profile
@kumaresan-rails
kumaresan-rails / create_spec.rb
Last active Jun 14, 2021
Graphiti - Polymorphic has many - Create
View create_spec.rb
require 'rails_helper'
RSpec.describe "employees#create", type: :request do
subject(:make_request) do
jsonapi_post "/api/v1/employees", payload
end
describe 'basic create' do
let(:payload) do
{
View uploads_controller.rb
class Api::UploadsController < ApiController
def create
@upload = Upload.new(upload_params)
ensure
clean_tempfile
end
private
View rails_next_cop.rb
# Cleans up branches like:
# if Shopify.rails_next?
# # Rails 5 login
# else
# # Rails 4 login
# end
module RuboCop
module Cop
module ShopifyRails
class RailsNextUnless < Cop
View Capybara-Rspec-Rails-assets-pipeline.md
@kumaresan-rails
kumaresan-rails / osx-setup.md
Created May 3, 2018 — forked from zenorocha/.hyper.js
Setup macOS Sierra (10.12)
View osx-setup.md

Setup macOS

I'm in a hospital in Spain and my MacBook was stolen.

Hospital Commit

Now I bought a new one and need to configure it. I have an AirPort Time Capsule that backs up everything using Time Machine, but I don't want all the crap I had in the old one. So let's get our hands dirty!

1. Update OS to latest version

@kumaresan-rails
kumaresan-rails / gist:956b4dc52e7acfd795d71fe0ff6a9917
Created Mar 20, 2017 — forked from wrburgess/gist:5528649
Backup Heroku Postgres database and restore to local database
View gist:956b4dc52e7acfd795d71fe0ff6a9917

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

@kumaresan-rails
kumaresan-rails / Sublime Text 3 Build 3103 License Key - CRACK
Created Feb 18, 2017
Sublime Text 3 Build 3103 License Key - CRACK
View Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@kumaresan-rails
kumaresan-rails / clockwork-init.sh
Created Jan 6, 2017 — forked from tomykaira/clockwork-init.sh
Create a new project with clockwork for heroku.
View clockwork-init.sh
#!/bin/sh
# Licence: MIT
# Created by tomykaira, 2011-10-25
if [ $# -ne 1 ]; then
echo "Give me your new project name (only)"
exit 1
fi
@kumaresan-rails
kumaresan-rails / pg_pub_sub.rb
Created Jan 4, 2017 — forked from chsh/pg_pub_sub.rb
PostgreSQL LISTEN/NOTIFY example for ruby
View pg_pub_sub.rb
#
# A:
# pubsub = PgPubSub.new('channelname')
# pubsub.subscribe do |data|
# puts "data: #{data} is coming!"
# end
#
# B:
# pubsub = PgPubSub.new('channelname')
# pubsub.publish("hello world")