This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'English' | |
| namespace :db do # rubocop:disable Metrics/BlockLength | |
| task :prevent_disparate_pg_dump_versions => :environment do | |
| allowed_pg_dump_version = '9.6.10'.freeze | |
| `pg_dump --version` | |
| pg_dump_exit_status = $CHILD_STATUS.exitstatus | |
| locally_installed_version = `pg_dump --version`.chomp[/(\d.*)/,1] rescue nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def moment_js_locale | |
| # to generate this list, go to https://cdnjs.com/libraries/moment.js | |
| # and run this in the console: | |
| # $('.library-url').map((index, cell) => "'" + $(cell).text().replace("https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.21.0/locale/", "").replace(".js", "") + "'").get().join(", ") | |
| valid_moment_js_locales = Set.new(['af', 'ar-dz', 'ar-kw', 'ar-ly', 'ar-ma', 'ar-sa', 'ar-tn', 'ar', 'az', 'be', 'bg', 'bm', 'bn', 'bo', 'br', 'bs', 'ca', 'cs', 'cv', 'cy', 'da', 'de-at', 'de-ch', 'de', 'dv', 'el', 'en-au', 'en-ca', 'en-gb', 'en-ie', 'en-il', 'en-nz', 'eo', 'es-do', 'es-us', 'es', 'et', 'eu', 'fa', 'fi', 'fo', 'fr-ca', 'fr-ch', 'fr', 'fy', 'gd', 'gl', 'gom-latn', 'gu', 'he', 'hi', 'hr', 'hu', 'hy-am', 'id', 'is', 'it', 'ja', 'jv', 'ka', 'kk', 'km', 'kn', 'ko', 'ky', 'lb', 'lo', 'lt', 'lv', 'me', 'mi', 'mk', 'ml', 'mr', 'ms-my', 'ms', 'mt', 'my', 'nb', 'ne', 'nl-be', 'nl', 'nn', 'pa-in', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sd', 'se', 'si', 'sk', 'sl', 'sq', 'sr-cyrl', 'sr', 'ss' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| source 'https://rubygems.org' | |
| gem 'sinatra' | |
| gem 'aws-sdk', '~> 3' | |
| gem 'httparty' | |
| gem 'twilio-ruby' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # based on https://github.com/rails/rails/blob/master/actionview/lib/action_view/helpers/tags/placeholderable.rb | |
| # config/initializers/tooltipable.rb | |
| module ActionView | |
| module Helpers | |
| module Tags # :nodoc: | |
| module Tooltipable # :nodoc: | |
| def initialize(*) | |
| super |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| translations: | |
| - file: "app/assets/javascripts/i18nautogen/i18n-%{locale}.js" | |
| only: ['*.js'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # config/initializers/translation_helper.rb | |
| module ActionView | |
| # = Action View Translation Helpers | |
| module Helpers | |
| module TranslationHelper | |
| private | |
| def scope_key_by_partial_with_views_prefix(key) | |
| if key.is_a?(String) && key.first == "." | |
| key = scope_key_by_partial_without_views_prefix(key) | |
| "views.#{key}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # i wish i did this in JS | |
| require 'sinatra' | |
| require 'fileutils' | |
| require 'json' | |
| require 'date' | |
| require 'time' | |
| require 'byebug' | |
| get "/devices" do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Calculator = {} | |
| function Calculator:new (o, input) -- the "account" example at http://www.lua.org/cgi-bin/demo made me think that you could just make classes, didn't realise the importance of all this boilerplate | |
| o = o or {name=name} | |
| setmetatable(o, self) | |
| self.__index = self | |
| self.input = input | |
| self.calculation = "(%d+) ?([+-/*]) ?(%d+)" -- not sure if i'm a fan of lua not supporting all regex features - http://lua-users.org/wiki/PatternsTutorial - but i suspect the benefits will be obvious after more digging | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ++[[]][+[]]+[]+[]+!+[]+"luv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my_set = JillSet.new | |
| my_set.insert("alex") # returns true | |
| my_set.insert("jill") # returns true | |
| my_set.has?("jill") # returns true | |
| my_set.has?("Jill") # returns false | |
| my_set.items # returns ["alex", "jill"] |