Skip to content

Instantly share code, notes, and snippets.

View jasmind's full-sized avatar

Jasmin Daguda jasmind

View GitHub Profile
@jasmind
jasmind / 00.md
Created November 9, 2016 10:47 — forked from maxivak/00.md
Sending emails with ActionMailer and Sidekiq

Sending emails with ActionMailer and Sidekiq

Send email asynchroniously using Sidekiq.

ActionMailer

Create your mailer us usual:

@jasmind
jasmind / how-to-copy-aws-rds-to-local.md
Created May 9, 2018 09:25 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
[color]
ui = true
[alias]
co = checkout
ci = commit
st = status
br = branch
di = diff
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[difftool "kdiff3"]
@jasmind
jasmind / gist:22984f77106bfc0afd151eb4383fca33
Created May 5, 2020 07:44
BeutifyRuby.sublime-settings
{
// Would you prefer a tab or two spaces to represent a tab
// The default is two spaces represented by 'space'
// anything else will use one tab character
"file_patterns": ["\\.html\\.erb", "\\.rb", "\\.rake", "Rakefile", "Gemfile", "Vagrantfile"],
"html_erb_patterns": ["\\.html\\.erb"],
"run_on_save": false,
"save_on_beautify": true,
"ruby": "c:\\jruby-9.1.17.0\\bin\\jruby"
}
{
"folder_exclude_patterns":
[
"public"
],
"font_size": 12,
"ignored_packages":
[
"Vintage"
],
@jasmind
jasmind / cheatsheet.rb
Created February 27, 2023 10:54 — forked from mabenson00/cheatsheet.rb
Rails ActiveRecord JSON cheatsheet
# Basic key operators to query the JSON objects :
# #> : Get the JSON object at that path (if you need to do something fancy)
# -> : Get the JSON object at that path (if you don't)
# ->> : Get the JSON object at that path as text
# {obj, n} : Get the nth item in that object
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE
# Date
# date before today
@jasmind
jasmind / gist:2e441a188bd313f817ec96ef899c055a
Created September 15, 2023 08:16
Opening up files with sublime text 3 in git bash in Windows
cd ~
touch .bashrc
vim .bashrc
alias subl="/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"
save and exit
source .bashrc
position in project folder
subl .

Example:

array_of_hashes = [
  {:a=>1}, {:a=>2}, {:a=>3},
  {:b=>4}, {:b=>5}, {:b=>6}, {:b=>7}, {:b=>8}, {:b=>9},
  {:c=>10}
]

Solution 1: