Skip to content

Instantly share code, notes, and snippets.

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

Arup Rakshit aruprakshit

🏠
Working from home
View GitHub Profile
@abhiaiyer91
abhiaiyer91 / reduxSelectorPattern.md
Last active April 29, 2022 06:00
Redux Selector Pattern

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:
@yang-wei
yang-wei / destructuring.md
Last active February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@benjaminbarbe
benjaminbarbe / README.md
Last active September 18, 2023 17:29 — forked from raucao/nginx-lua-s3.nginxconf
Nginx proxy to S3 with caching
@jdickey
jdickey / Trivial example of isolating Rails helper logic.rb
Last active October 9, 2015 03:55
Trivial example of isolating Rails helper logic.
# In app/helpers/users_helper.rb
require_relative 'users_helper/greet'
module UsersHelper
module Internals
end
private_constant :Internals
include Internals
@corbanb
corbanb / JavaScript.sublime-build
Last active May 2, 2022 22:56
Sublime Text - Tools > Build System > New Build System
// Sublime Text - Build System for Javascript
{
"cmd": ["node", "$file"],
"selector": "source.js"
}
class Wrong
def method_missing(m, *)
if m =~ /\Ahello_(.+)\z/
puts "Hello, #{$1.capitalize}"
else
super
end
end
end
@turbod
turbod / copy_carrierwave_files.rb
Created March 17, 2014 12:26
Copy carrierwave files to another model
original_solution.files.each do |original_file|
f = original_file.dup
f.remote_name_url = original_file.name.url
new_solution.files << f
end
@Kartones
Kartones / sublime-text-cheatsheet.md
Last active January 18, 2021 17:43
Sublime Text 3 Cheatsheet

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
@maxim
maxim / rails_load_path_tips.md
Last active April 13, 2023 13:28
How to use rails load paths, app, and lib directories.

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 July 6, 2013 20:54
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres

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