Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Arup Rakshit aruprakshit

🏠
Working from home
View GitHub Profile
@maxim
maxim / rails_load_path_tips.md
Last active Sep 8, 2021
How to use rails load paths, app, and lib directories.
View rails_load_path_tips.md

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

@JamesDullaghan
JamesDullaghan / digitalocean.md
Created Jul 6, 2013
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres
View digitalocean.md

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

@heygrady
heygrady / mapDispatchToProps.md
Last active Jul 19, 2021
Redux containers: mapDispatchToProps
View mapDispatchToProps.md

Redux containers: mapDispatchToProps

This document details some tips and tricks for creating redux containers. Specifically, this document is looking at the mapDispatchToProps argument of the connect function from [react-redux][react-redux]. There are many ways to write the same thing in redux. This gist covers the various forms that mapDispatchToProps can take.

@joelmoss
joelmoss / gist:2470666
Created Apr 23, 2012
Capistrano recipe for Puma start/stop/restarts
View gist:2470666
set :shared_children, shared_children << 'tmp/sockets'
namespace :deploy do
desc "Start the application"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{stage} bundle exec puma -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{stage}.log 2>&1 &", :pty => false
end
desc "Stop the application"
task :stop, :roles => :app, :except => { :no_release => true } do
View reduxSelectorPattern.md

Redux Selector Pattern

Imagine we have a reducer to control a list of items:

function listOfItems(state: Array<Object> = [], action: Object = {}): Array<Object> {
  switch(action.type) {
    case 'SHOW_ALL_ITEMS':
      return action.data.items
    default:
@naaman
naaman / delete-heroku-apps.sh
Last active Mar 5, 2021
[WARNING THIS WILL HARD DELETE YOUR APPS. YOU COULD LOSE DATA. MAKE SURE YOU KNOW WHAT YOURE DOING!!!!!!!!!!] Delete all heroku apps from bash terminal -- no script file required
View delete-heroku-apps.sh
for app in $(heroku apps); do heroku apps:destroy --app $app --confirm $app; done
@corbanb
corbanb / JavaScript.sublime-build
Last active Feb 26, 2021
Sublime Text - Tools > Build System > New Build System
View JavaScript.sublime-build
// Sublime Text - Build System for Javascript
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
@benjaminbarbe
benjaminbarbe / README.md
Last active Feb 25, 2021 — forked from raucao/nginx-lua-s3.nginxconf
Nginx proxy to S3 with caching
View README.md
@Kartones
Kartones / sublime-text-cheatsheet.md
Last active Jan 18, 2021
Sublime Text 3 Cheatsheet
View sublime-text-cheatsheet.md

Keyboard shorcuts

  • CTRL + SHIFT + p: Command panel
  • CTRL + p: File search
  • CTRL + r: Method search inside current file
  • CTRL + g: Go to line #
  • CTRL + SHIFT + [: Fold code
  • CTRL + SHIFT + ]: Unfold code
  • ALT + SHIFT + 2: Double column/file mode
  • ALT + SHIFT + 1: Single column/file mode
@azer
azer / fake-chat.elm
Created May 21, 2018
Elm Ports Example
View fake-chat.elm
port module FakeChat exposing (..)
import Html exposing (Html, div, input, text, button, ul, li)
import Html.Events exposing (onClick, onInput)
import Html.Attributes exposing (type_, placeholder, value)
main =
Html.program
{ view = view