Skip to content

Instantly share code, notes, and snippets.

@Arkweid
Arkweid / Gemfile
Created June 29, 2020 14:01 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers

Keybase proof

I hereby claim:

  • I am arkweid on github.
  • I am arkweid (https://keybase.io/arkweid) on keybase.
  • I have a public key ASBQoJSvE7FwDwL23uoHT3YwbyBZjy39L9DAuvanhP2quAo

To claim this, I am signing this object:

@Arkweid
Arkweid / gist:4019b1d7309ecb332b83b88d1c31fa1e
Created February 13, 2019 15:25 — forked from danielestevez/gist:2044589
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@Arkweid
Arkweid / gist:57221b14283ed1ba286f0641474d77d8
Created October 22, 2018 12:05
Postgres indexes cheatsheet
B-Tree - For most datatypes and queries
GIN - For JSONB/hstore/arrays
GiST - For full text search and geospatial datatypes
SP-GiST - For larger datasets with natural but uneven clustering
BRIN - For really large datasets that line up sequentially
Hash - For equality operations, and generally B-Tree still what you want here
@Arkweid
Arkweid / nrdebug.rb
Created September 20, 2018 19:50
Attach for debug process | sudo ruby nrdebug.rb <pid>
#!/usr/bin/env ruby
# encoding: utf-8
require 'tempfile'
require 'rbconfig'
def fail(msg, opts={})
$stderr.puts(msg)
usage() if opts[:usage]
@Arkweid
Arkweid / Guardian JWT.md
Created September 14, 2018 21:42 — forked from nikneroz/Guardian JWT.md
Elixir + Phoenix Framework + Guardian + JWT. This is tutorial and step by step installation guide.

Elixir + Phoenix Framework + Guardian + JWT + Comeonin

Preparing environment

We need to generate secret key for development environment.

mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf

Let's generate User model and controller.

@Arkweid
Arkweid / curl.md
Created February 16, 2018 12:26 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Arkweid
Arkweid / inline_rails.rb
Created December 25, 2017 09:10
IFTTT Rails inline
IFTTT_SERVICE_KEY = "REPLACE_ME"
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "rails", "~> 5.0"
end
require "action_controller/railtie"
#########################
# Recursive Binary Search
#########################
def r_binary_search(array, val, low = 0, high = (array.size - 1))
return nil if high < low
mid = (low + high) / 2
case val <=> array[mid]
@Arkweid
Arkweid / gist:58f4bd424419ca2e267fd3c03ad37e49
Last active December 4, 2017 13:42
Sorting algorithm on Ruby
############
# QUICK SORT
############
def qsort(array)
return [] if array.empty?
left, right = array[1..-1].partition { |y| y <= array.first }
qsort(left) + [array.first] + qsort(right)
end