Skip to content

Instantly share code, notes, and snippets.

View rajeshkp's full-sized avatar

Rajesh Koilpillai rajeshkp

View GitHub Profile
@MarkEdmondson1234
MarkEdmondson1234 / online_google_auth.r
Last active October 5, 2018 13:42
Google OAuth2 Authentication functions for an R Shiny app
## GUIDE TO AUTH2 Authentication in R Shiny (or other online apps)
##
## Mark Edmondson 2015-02-16 - @HoloMarkeD | http://markedmondson.me
##
## v 0.1
##
##
## Go to the Google API console and activate the APIs you need. https://code.google.com/apis/console/?pli=1
## Get your client ID, and client secret for use below, and put in the URL of your app in the redirect URIs
## e.g. I put in https://mark.shinyapps.io/ga-effect/ for the GA Effect app,
@hrbrmstr
hrbrmstr / shinyapp.sh
Last active October 3, 2016 21:45
Small script to help in creating one-click R+Shiny apps on OS X
#!/bin/bash
#
# v1.0 - Initial release - @hrbrmstr
#
# Script to turn a R+Shiny gist into a one-click OS X application
#
# Just enter in the gist ID and the app name you want, optionally providing
# a custom icns file and also optionally code-signing the built app
#
# It does rudimentary checking to ensure the gist id is, in fact a Shiny app.
@CHLibrarian
CHLibrarian / context-rule-beacon-create.js
Created August 29, 2014 18:09
ContextHub Context Rule Beacon Create Gist
// Creating a beacon
var newBeacon = {}
newBeacon.name = "New beacon"
newBeacon.uuid = "7EA016FB-B7C4-43B0-9FCC-AAB391AE1722"
newBeacon.major = 100
newBeacon.minor = 1
newBeacon.tags = "beacon-tag"
beacon.create(newBeacon.tags, newBeacon.name, newBeacon.uuid, newBeacon.major, newBeacon.minor)
console.log("Created beacon '" + newBeacon.name + "'")
@ryanray
ryanray / deploy.rb
Created November 21, 2013 11:15
I couldn't find a quick example of how to deploy a node.js app using Capistrano 3. This gist assumes you are using Capistrano 3, Upstart, Forever, ssh/forward agent, and an unprivileged user named 'deploy'. Hopefully this simple setup will help to get you started.
# config/deploy.rb
# probably a lot of ways to improve this...
set :application, 'my_app'
set :repo_url, 'git@github.com:USERNAME/my_app.git'
# should set up a deploy user
set :user, 'deploy'
set :deploy_to, '/var/www/my_app'
set :scm, :git
@ryansobol
ryansobol / gist:5252653
Last active November 4, 2025 18:51
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@mattetti
mattetti / tracepoint_middlware.rb
Created March 6, 2013 06:34
test middleware for Ruby 2.0 logging the method dispatches going on when a request is being handled.
class TracePoint
class Middleware
def initialize(app)
@app = app
end
def call(env)
stats = {}
trace = TracePoint.new(:call) do |tp|
begin
require 'newrelic_rpm'
require 'new_relic/agent/instrumentation/controller_instrumentation'
NewRelic::Agent.after_fork(:force_reconnect => true)
rescue LoadError
end
require File.dirname(__FILE__) + '/config/environment'
run ActionController::Dispatcher.new
@subelsky
subelsky / puma_rails_heroku.rb
Created October 31, 2012 13:51
Setting up Puma and Rails on Heroku
# Gemfile
gem "puma"
# Procfile
web: bundle exec puma -p $PORT -e $RACK_ENV -C config/puma.rb
# add to config block config/environments/production.rb
config.threadsafe!
# get rid of NewRelic after_fork code, if you were doing this:
@timcheadle
timcheadle / README.md
Last active December 23, 2025 17:44
Make /robots.txt aware of the Rails environment

Make /robots.txt aware of the Rails environment

You probably don't want Google crawling your development staging app. Here's how to fix that.

$ mv public/robots.txt config/robots.production.txt
$ cp config/robots.production.txt config/robots.development.txt

Now edit config/routes.rb to add a route for /robots.txt, and add the controller code.

@igorsokolov
igorsokolov / transporter_chief.rb
Created July 12, 2012 07:19
Transporter Chief - upload iOS application to iOS devices
#!/usr/bin/ruby
require 'optparse'
require 'ostruct'
require 'fileutils'
require 'pathname'
require 'tmpdir'
$script_path = File.expand_path(File.dirname(__FILE__))
$temp_path = Dir.mktmpdir