Skip to content

Instantly share code, notes, and snippets.

View finist's full-sized avatar

Nikolai Seskin finist

  • Porto, Portugal
View GitHub Profile
@finist
finist / gist:4123995
Last active October 13, 2015 02:18
postgres
export PATH=/usr/local/bin:$PATH
Start manually:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Stop manually:
pg_ctl -D /usr/local/var/postgres stop -s -m fast
pg_ctl -D /usr/local/var/postgres status
@nathany
nathany / config.ru
Last active May 3, 2019 17:10
Magical Unicorn Configuration for Heroku
# add something like this to config.ru
# see https://github.com/kzk/unicorn-worker-killer
if Integer(ENV['UNICORN_KILLER'] || 0) != 0
require 'unicorn/worker_killer'
# Max memory size (RSS) per worker
use Unicorn::WorkerKiller::Oom, (350*(1024**2)), (400*(1024**2)), 30, true
end
@davidbella
davidbella / person.rb
Created October 10, 2013 13:37
Ruby: Dynamic meta-programming to create attr_accessor like methods on the fly
class Person
def initialize(attributes)
attributes.each do |attribute_name, attribute_value|
##### Method one #####
# Works just great, but uses something scary like eval
# self.class.class_eval {attr_accessor attribute_name}
# self.instance_variable_set("@#{attribute_name}", attribute_value)
##### Method two #####
# Manually creates methods for both getter and setter and then
@eduwass
eduwass / 0. Custom Date Formats in Rails.md
Last active February 12, 2025 06:25
Custom Date Formats in Rails

Custom Date Formats in Rails

Quick guide on printing pretty dates in Rails

@gettalong
gettalong / README.md
Last active June 9, 2021 17:57
Using a TrueType font with HexaPDF

HexaPDF is now able to use a TrueType font to generate content. There are still some limitations, like the missing support for subsets but most things work quite well already. Complete integration into the Canvas and font selection API is also not done yet.

The attached script generates a PDF showcasing all available glyphs defined in a font as well as a sample text containing characters from the Unicode BMP as well as from other Unicode planes.

@bbonamin
bbonamin / Brewfile
Last active August 9, 2025 22:03
Capybara Selenium Webdriver: Headless Chrome (with file downloads!) & Headless Firefox
tap "caskroom/cask"
cask "google-chrome"
cask "firefox"
brew "chromedriver"
brew "geckodriver"
@mrmartineau
mrmartineau / stimulus.md
Last active December 19, 2025 14:04
Stimulus cheatsheet