I hereby claim:
- I am pikachuexe on github.
- I am pikachuexe (https://keybase.io/pikachuexe) on keybase.
- I have a public key ASC32BMYJZ9ooOBpy6iF2ViTy_BzRD4QsY9kY4uL2mevSgo
To claim this, I am signing this object:
/* eslint-disable global-require */ | |
/* eslint-env node */ | |
const validEnv = ["development", "test", "production"] | |
const currentEnv = process.env.NODE_ENV || "unknown" | |
const isDevelopmentEnv = currentEnv === "development" | |
const isProductionEnv = currentEnv === "production" | |
const isTestEnv = currentEnv === "test" | |
if (!validEnv.includes(currentEnv)) { |
Homebrew build logs for elasticsearch on macOS 10.13.6 | |
Build date: 2018-10-05 09:04:53 |
FROM user/baseimage:version-tag | |
# 1. This is VERY basic | |
# 2. Need to load RVM first during build | |
# 3. Create empty folders for runtime files | |
RUN \ | |
rm /bin/sh && ln -s /bin/bash /bin/sh && \ | |
mkdir -p \ | |
/home/app/webapp \ |
I hereby claim:
To claim this, I am signing this object:
# https://github.com/rspec/rspec-rails/issues/255 | |
require 'active_support/concern' | |
module DefaultParams | |
extend ActiveSupport::Concern | |
included do | |
let(:default_params) { {locale: I18n.locale} } | |
def process_with_default_params(action, http_method = 'GET', *args) |
#lib/routing.rb | |
# SO: http://stackoverflow.com/questions/16720514/how-to-use-url-helpers-in-lib-modules-and-set-host-for-multiple-environments | |
module Routing | |
extend ActiveSupport::Concern | |
include Rails.application.routes.url_helpers | |
included do | |
def default_url_options | |
{ :locale => I18n.locale } |
# Use a different cache store based on memcached is running or not | |
begin | |
# check if memcached is running; if it is, use that instead of the default memory cache | |
Timeout.timeout(0.5) { TCPSocket.open("localhost", 11211) { } } | |
config.cache_store = :dalli_store, %w(localhost:11211), {namespace: Rails.application.class.parent_name, expires_in: 1.day, compress: true} | |
$stderr.puts "Using memcached on localhost:11211" | |
rescue StandardError | |
$stderr.puts "memcached not running, caching to memory" | |
end |
### | |
Toggle Display | |
Put the data attributes on a button or link | |
Required attributes: | |
data-toggle: 'display' | |
data-target: selector of target element | |
Optional attibutes: | |
data-effect: 'slide', 'fade', other values (no effect) |
// This class use direct selector '>' since you might want to use it nested way | |
// Like hover menu, then hover button | |
.hoverable-container { | |
& > .hoverable-content.on-hover { | |
display: none; | |
} | |
&:hover { | |
// Hide the default one |
jQuery ($) -> | |
$(document).on "click", '.js-toggleable-container', -> | |
$(this).toggleClass("is-toggled") |