I hereby claim:
- I am fnordfish on github.
- I am fnordfish (https://keybase.io/fnordfish) on keybase.
- I have a public key ASAsnbLeS3CQ3GCuWeQ8aT64rQwmS0BcH_jMEuBN8-HP_Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| ## | |
| # Use hamlit instead of haml for rendering | |
| # This is basically a copy of the existing integration for slim | |
| RENDERING=<<'RUBY' | |
| module Padrino | |
| module Helpers | |
| module OutputHelpers | |
| ## | |
| # Handler for Hamlit templates. |
| property LookTime : 10 -- interval to check process | |
| property RamDiskSizeMB : 128 -- size of the Ramdisk in MB | |
| on mount() | |
| do shell script "diskutil erasevolume HFS+ 'SpotifyRamDisk' `hdiutil attach -nomount ram://" & (RamDiskSizeMB * 2048) & "`" | |
| end mount | |
| on link() | |
| do shell script "ln -fs '/Volumes/SpotifyRamDisk' ~/Library/Caches/com.spotify.client" | |
| end link |
| module SidekiqSequel | |
| module Middleware | |
| class Server | |
| attr_reader :db | |
| def initialize(options = nil) | |
| @db = options[:db] | |
| @max_retry = options.fetch(:max_retry, 5) | |
| @error_classes = @db.send(:database_error_classes).dup.freeze | |
| end |
| # config/initializers/yaks.rb | |
| require "yaks-sinatra" | |
| # Usage: | |
| # In your "app/app.rb": `register YaksInitializer` | |
| module YaksInitializer | |
| def self.registered(app) | |
| # code run on application `register YaksInitializer` | |
| # this code is run every time `app.rb` is reloaded | |
| app.register Yaks::Sinatra |
| module YaksSequel | |
| class CollectionMapper < Yaks::CollectionMapper | |
| attr_reader :collection_dataset | |
| def call(collection, *args) | |
| return super unless collection.is_a?(Sequel::Dataset) | |
| @collection_dataset = collection | |
| if collection.opts[:eager_graph] | |
| super(collection.all, *args) |
| CREATE OR REPLACE FUNCTION safe_refresh_materialized_view_concurrently(_name regclass) | |
| RETURNS void AS $$ | |
| BEGIN | |
| EXECUTE 'REFRESH MATERIALIZED VIEW CONCURRENTLY ' || _name; | |
| EXCEPTION | |
| -- when a materialized view is not populated, concurrently will not work and throw feature_not_supported | |
| WHEN feature_not_supported THEN | |
| EXECUTE 'REFRESH MATERIALIZED VIEW ' || _name; | |
| END | |
| $$ LANGUAGE plpgsql; |
| #!/bin/bash | |
| add_dns_config() { | |
| local interface=$1; shift | |
| sudo networksetup -setdnsservers "${interface}" $@ | |
| } | |
| main() { | |
| local servers= | |
| servers=() | |
| local line= |
| #!/usr/bin/env duct # ruby | |
| # Usage: | |
| # duct current_uts_offsets.rb <Country as its ISO 3166 code> <strftime-format> | |
| # Example: | |
| # duct current_uts_offsets.rb US | |
| # #=> US: -0500 -0600 -0700 -0800 -0900 -1000 | |
| # duct current_uts_offsets.rb RU '%:z' | |
| # #=> RU: +02:00 +03:00 +04:00 +05:00 +06:00 +07:00 +08:00 +09:00 +10:00 +11:00 +12:00 | |
| require 'time' |
| Vagrant.configure(2) do |global_config| | |
| global_config.vm.define :my_project do |config| | |
| # | |
| # ... All your stuff ... | |
| # | |
| # Auto-Mount the boxes "/home/vagrant" onto your local machine | |
| if Vagrant.has_plugin? 'vagrant-triggers' | |
| def box_ip(config) | |
| if (net_cgf = config.vm.networks.find {|k, _| k == :private_network}) |