Skip to content

Instantly share code, notes, and snippets.

@wingrunr21
wingrunr21 / environment.js
Created October 2, 2017 19:43
Simple webpacker server side rendering
const webpack = require('webpack')
const { environment } = require('@rails/webpacker')
// Don't use commons chunk for server_side_render chunk
const entries = environment.toWebpackConfig().entry
const commonsChunkEligible = Object.keys(entries).filter(name => name !== 'server_side_render')
environment.plugins.set('CommonsChunkVendor', new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: (module, count) => {
@wingrunr21
wingrunr21 / chnode.rb
Last active January 8, 2018 22:27
Unofficial chnode Homebrew (brew) formula
class Chnode < Formula
desc "Change between installed Node versions in your current shell."
homepage "https://github.com/steakknife/chnode"
url "https://github.com/steakknife/chnode/archive/v1.2.3.tar.gz"
sha256 "ae0bd1d9227ef76286d19331f9a3c5fcc1926e70f4ef0d3896a8f9f7b463c792"
head "https://github.com/steakknife/chnode.git"
def install
bin.install "chnode", "chnode-auto", "chnode-exec"
doc.install "README.md", "LICENSE", "CHANGELOG.md"
@wingrunr21
wingrunr21 / catchall.coffee
Created October 23, 2013 13:27
A simple catchall script for Hubot to process anything it doesn't know how to handle via Wolfram|Alpha
Wolfram = require('wolfram-alpha').createClient(process.env.HUBOT_WOLFRAM_APPID)
module.exports = (robot) ->
robot.catchAll (msg) ->
r = new RegExp "^(?:#{robot.alias}|#{robot.name}) (.*)", "i"
matches = msg.message.text.match(r)
if matches != null && matches.length > 1
Wolfram.query matches[1], (e, result) ->
if result and result.length > 0
msg.send result[1]['subpods'][0]['text']
@wingrunr21
wingrunr21 / SassMeister-input.scss
Created January 21, 2014 14:47
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.2)
// Compass (v1.0.0.alpha.17)
// ----
$turquoise: #000000;
$green-sea: #ffffff;
@mixin calc-color($first-color, $second-color) {
.palette-#{$first-color} {
@wingrunr21
wingrunr21 / osx_compat.rb
Created October 11, 2013 22:52
A simple utility module we used to detect the version of OS X currently running in order to work around the oracle-instant-client segfault problem.
module OSXCompat
OSX_REGEX = /darwin\d{2}/
SNOW_KITTY = "darwin10"
class << self
def snow_kitty_or_lower?
if darwin?
osx_version <= SNOW_KITTY
else
@wingrunr21
wingrunr21 / config.rb
Created June 13, 2013 15:31
RBX 2.0.0-dev compile problem on 12.10 with MRI build ruby
module Rubinius
# Make this reload friendly without silly constant defined warnings.
BUILD_CONFIG = {
:command_line => "--prefix=/opt/rbenv/versions/rbx-2.0.0-dev --gemsdir=/opt/rbenv/versions/rbx-2.0.0-dev",
:which_ruby => :ruby,
:build_ruby => "/usr/bin/ruby1.9.1",
:build_rake => "rake",
:build_perl => "perl",
:llvm => :prebuilt,
:llvm_configure => "/tmp/ruby-build.20130613152938.5290/rubinius-2.0.0-dev/vendor/llvm/Release/bin/llvm-config",
@wingrunr21
wingrunr21 / config.rb
Created June 13, 2013 15:28
RBX 2.0.0-dev compile problem on 12.10
module Rubinius
# Make this reload friendly without silly constant defined warnings.
BUILD_CONFIG = {
:command_line => "--prefix=/opt/rbenv/versions/rbx-2.0.0-dev --gemsdir=/opt/rbenv/versions/rbx-2.0.0-dev",
:which_ruby => :rbx,
:build_ruby => "/opt/rbenv/versions/rbx-2.0.0-dev/bin/rbx",
:build_rake => "rake",
:build_perl => "perl",
:llvm => :prebuilt,
:llvm_configure => "/tmp/ruby-build.20130613144949.24356/rubinius-2.0.0-dev/vendor/llvm/Release/bin/llvm-config",
@wingrunr21
wingrunr21 / output.txt
Created March 7, 2013 21:15
her does not pass query parameters when doing relation lookups
2013-03-07 14:14:35] INFO WEBrick 1.3.1
[2013-03-07 14:14:35] INFO ruby 1.9.3 (2013-01-15) [x86_64-darwin12.3.0]
[2013-03-07 14:14:35] INFO WEBrick::HTTPServer#start: pid=54326 port=3000
her version: 0.4.1
localhost - - [07/Mar/2013:14:14:35 MST] "GET /users/1?foobar=true HTTP/1.1" 200 10
- -> /users/1?foobar=true
localhost - - [07/Mar/2013:14:14:35 MST] "GET /users/1/projects HTTP/1.1" 200 10
- -> /users/1/projects
[2013-03-07 14:14:35] INFO going to shutdown ...
@wingrunr21
wingrunr21 / postal_code_lookup.rb
Created January 4, 2013 23:55
A quick module for doing postal code lookups from the geonames.org JSON API.
require 'multi_json'
module PostalCodeLookup
GEONAMES_URL = 'http://api.geonames.org/postalCodeSearchJSON'
def self.find_postal_code_data(code)
info = nil
begin
client = HTTPClient.new
@wingrunr21
wingrunr21 / airbrake.rb
Created November 26, 2012 21:11
Airbrake environment by hostname
Airbrake.configure do |config|
# ...
if Rails.env.staging?
config.environment_name = `hostname -f`.strip
end
# ...
end