Skip to content

Instantly share code, notes, and snippets.

View PikachuEXE's full-sized avatar
Pika~Pika~

PikachuEXE PikachuEXE

Pika~Pika~
View GitHub Profile
@PikachuEXE
PikachuEXE / babel_loader_builder.js
Created March 18, 2019 08:02
Webpacker 4 multiple target config
/* 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)) {
@PikachuEXE
PikachuEXE / # elasticsearch - 2018-10-05_09-04-53.txt
Created October 5, 2018 02:23
elasticsearch on macOS 10.13.6 - Homebrew build logs
Homebrew build logs for elasticsearch on macOS 10.13.6
Build date: 2018-10-05 09:04:53
@PikachuEXE
PikachuEXE / Dockerfile.app_image
Created September 14, 2018 01:37
2 stage rails app docker image building
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 \

Keybase proof

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:

@PikachuEXE
PikachuEXE / default_params.rb
Last active January 1, 2016 07:09
The monkey patch to apply default parameters/default_url_options in RSpec (Rails 4 only)
# 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 }
@PikachuEXE
PikachuEXE / check_for_memcached.rb
Last active December 21, 2015 12:19 — forked from subelsky/check_for_memcached.rb
Use memcached as cache store on development if it is running
# 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
@PikachuEXE
PikachuEXE / toggle-display.js.coffee
Created April 26, 2013 05:13
Toggle Display A small JavaScript to toggle display of target element(s)
###
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)
@PikachuEXE
PikachuEXE / hoverable.scss
Created April 26, 2013 05:04
Hoverable Similar to Toggleable But this one does not require script
// 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
@PikachuEXE
PikachuEXE / toggleable.js.coffee
Created April 26, 2013 05:01
Toggleable Just a small style and a script file to toggle display content (on/off)
jQuery ($) ->
$(document).on "click", '.js-toggleable-container', ->
$(this).toggleClass("is-toggled")