Skip to content

Instantly share code, notes, and snippets.

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

Gagan Shrestha ckgagan

🏠
Working from home
View GitHub Profile
# This is to enable WS support. Credits: # https://gist.github.com/Bubelbub/0a942a0d51a3d329897d
# THIS WORKS! for running the example 5.0.0.beta1 chat app on a single instance Elastic beanstalk AWS instance
files:
"/etc/nginx/conf.d/websockets.conf" :
content: |
upstream backend {
server unix:///var/run/puma/my_app.sock;
}
@ckgagan
ckgagan / spacemacs-cheshe.md
Created July 14, 2017 08:32 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
require 'prawn'
require 'pdf/toolkit'
class PdfFiller
DOWNLOAD = "/tmp/downloads"
FINAL_DIR = "#{Dir.home}/edited_files"
attr_reader :file_path
def initialize( file_path)
require 'RMagick'
# Auto crop an image by detecting solid edges around them.
class AutoCropper
# How small we accept a cropped picture to be. E.G. if it was 100x100 and
# ratio 0.1, min output should be 10x10
MIN_CROP_RATIO = 0.1
attr_reader :img, :x0, :y0, :x1, :y1, :min_width, :min_height, :rows, :columns, :is_border
@ckgagan
ckgagan / spec_helper.rb
Created July 17, 2013 04:22
spec_helper.rb file content
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'capybara/rspec'
include Warden::Test::Helpers
# Requires supporting ruby files with custom matchers and macros, etc,
<!DOCTYPE>
<html>
<head>
<title>Dissecting Gmail's Email Attachments - Dropping Files</title>
<style>
.msg {
display: none
}
.dragging .msg {
@ckgagan
ckgagan / ror installation guide
Created September 23, 2012 16:25
ROR installation
sudo apt-get update system => for updating system
sudo apt-get install build-essential git-core for intalling git
sudo apt-get install curl => for installing curl
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) => installing rvm
echo '[[ -s "/home/{{username}}/.rvm/scripts/rvm" ]] && source "/home/{{username}}/.rvm/scripts/rvm"' >> ~/.bashrc => to load rvm in bashrc
@ckgagan
ckgagan / user_setting_sublime
Created August 27, 2012 06:10
Sublime User settings
{
"anypreter_output_inteval": 1,
"anypreter_stream_output": false,
"bold_folder_labels": false,
"detect_slow_plugins": false,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
@ckgagan
ckgagan / gist:3424223
Created August 22, 2012 10:32 — forked from kxhitiz/gist:3412158
FB App Development Resources Collection
http://net.tutsplus.com/tutorials/javascript-ajax/design-and-code-an-integrated-facebook-app/
https://developers.facebook.com/docs/opengraph/tutorial/
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby