Skip to content

Instantly share code, notes, and snippets.

View Ch4s3's full-sized avatar

Chase Gilliam Ch4s3

View GitHub Profile
@Ch4s3
Ch4s3 / maximum_hourglass_sum.rb
Created March 29, 2018 19:54
ruby maximum hourglass sum
def sum_hour_glass(c, r, two_d_array)
top = two_d_array[r][c..c+2].inject(:+)
center = two_d_array[r +1][c+1]
bottom = two_d_array[r+2][c..c+2].inject(:+)
top + center + bottom
end
def array2D(arr)
max = -1.0/0.0
arr.each_with_index do |row, r_i|
@Ch4s3
Ch4s3 / csp_middleware.rb
Created January 30, 2018 05:21
simple rack middleware to set a csp header
module Rack
# Simple rack middleware to
# allow me to use a webworker locally
class CspMiddleware
def initialize(app, options = {})
@app = app
@options = options
end
def call(env)
@Ch4s3
Ch4s3 / turboLinksPreFetch.js
Last active February 9, 2022 17:26
decaffeinated version of https://gist.github.com/Enalmada/6e11191c1ea81a75a4f266e147569096 with a flag for turning it on or off
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const OldHttpRequest = Turbolinks.HttpRequest;
Turbolinks.CachedHttpRequest = class CachedHttpRequest extends Turbolinks.HttpRequest {
constructor(_, location, referrer) {
super();

Keybase proof

I hereby claim:

  • I am Ch4s3 on github.
  • I am chasegilliam (https://keybase.io/chasegilliam) on keybase.
  • I have a public key whose fingerprint is 962E F808 BB3F FAF9 D466 0CE0 0ED4 0192 321E F04D

To claim this, I am signing this object:

"use strict";
const path = require("path");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const cssLoaders = [
{
loader: "css-loader",
options: {
modules: true,
minimize: true
@Ch4s3
Ch4s3 / install_and_deploy_elixir_phoenix_on_centos7_rhel.md
Last active April 30, 2022 19:44
Instructions for installing Elixir 1.4, Phoenix 1.2.x, and Erlang 19+ on Centos7/RHEL and deploy with edeliver and distillery. Webpack + React + Yarn for JS

Set the environment variables

Install nano(or not if you intend to use vi)

yum install -y nano

Open ~/.profile with nano ~/.profile and add the following:

@Ch4s3
Ch4s3 / install-postgres-9.6-centos7.md
Last active January 29, 2025 09:33
steps for installing postgres 9.6 on Centos7 or RHEL

Update the RPM package

rpm -ivh https://yum.postgresql.org/9.6/redhat/rhel-7.3-x86_64/pgdg-centos96-9.6-3.noarch.rpm

Update packages

yum update
"use strict";
const path = require("path");
const webpack = require("webpack");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const ClosureCompiler = require("google-closure-compiler-js").webpack;
module.exports = {
context: __dirname + "/source",
entry: {
site: "./javascripts/all.js",
@Ch4s3
Ch4s3 / package.json
Last active August 2, 2016 13:21
dev dependencies in package.json related to karma/jasmine testing
"devDependencies": {
"react-addons-test-utils": "^15.2.1",
"expect": "^1.13.0",
"jasmine": "^2.3.4",
"karma": "^0.13.15",
"karma-chrome-launcher": "^0.2.2",
"karma-jasmine": "^0.2.1",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^1.7.0"
}
require "nokogiri"
require "concurrent"
################################
# Methods
################################
def parse_data_into_chuncks(data)
chunks = {}
ccda.css("chunk section").each do |chunk|