Skip to content

Instantly share code, notes, and snippets.

View egoens's full-sized avatar

Erik Goens egoens

View GitHub Profile
@egoens
egoens / example_job.rb
Created April 1, 2017 22:20 — forked from hopsoft/example_job.rb
Render views outside of the standard request context (i.e. ActiveJob) with Devise/Warden
class ExampleJob < ApplicationJob
queue_as :default
def perform(user)
# do some work
# HACK: get around limitations in devise/warden when rendering
# views outside the context of a formal http request
renderer = ::ApplicationController.renderer.new
renderer_env = renderer.instance_eval { @env }
@egoens
egoens / svgo-fonts.json
Created March 1, 2017 16:30
SVGO Font Compressor Configuration
{
"comment": "This is the settings file for the SVGO Compressor Plugin. For more info, please check <https://github.com/BohemianCoding/svgo-compressor>",
"pretty": true,
"indent": 2,
"plugins": [
{
"name": "cleanupIDs"
},
{
"name": "cleanupListOfValues",
@egoens
egoens / data.yml
Created January 27, 2017 17:26
Example data
---
:assignments:
:section_avg:
1:
:due: '2017-01-01'
:points_possible: 10
:points_received: 6
:title: Aspernatur accusamus quia natus cumque sed saepe eveniet.
2:
:due: '2017-01-04'
@egoens
egoens / doc.md
Last active December 29, 2016 13:57 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails'
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

@egoens
egoens / bulma-centered-card.markdown
Created December 23, 2016 15:48
Bulma - Centered Card
@egoens
egoens / ScrollSpy.js
Created November 20, 2016 17:11 — forked from jquense/ScrollSpy.js
React ScrollSpy
import React, { PropTypes } from 'react';
import { findDOMNode } from 'react-dom'
import getOffset from 'dom-helpers/query/offset';
let ScrollSpy = React.createClass({
childContextTypes: {
$scrollSpy: PropTypes.shape({
anchor: PropTypes.func,
activeTarget: PropTypes.string
})
@egoens
egoens / aws.sh
Created November 2, 2016 18:15 — forked from conleym/aws.sh
Export AWS key variables based on profile name
# Shortcut for assigning a heredoc to a variable.
# http://stackoverflow.com/a/8088167
define() {
# read will have exit status 1 whenever it assigns to a variable or it gets to EOF.
read -r -d '' "${1}" || true
}
_other_aws_common_stuff() {
export AWS_DEFAULT_PROFILE="${AWS_PROFILE}"
local SCRIPT
@egoens
egoens / yml_to_json.rb
Created May 11, 2016 17:17
YML to JSON
# as file yml_to_json.rb
require 'yaml'
require 'json'
output = File.open('new_file_name.json','w')
output << JSON.pretty_generate(YAML.load_file('./yaml_file.yml'))
output.close
# one liner
ruby -e "require 'yaml';require 'json';output = File.open('new_file_name.json','w');output << JSON.pretty_generate(YAML.load_file('./yaml_file.yml'));output.close"
@egoens
egoens / Readme.md
Last active May 9, 2016 19:21
Generate/Destory rails scaffolding

Requirements

Must create a docs folder and put models.yml inside this folder.

#!/bin/bash
GIT_DIR=/home/deploy/[app_name]
WORK_TREE=/var/www/[app_name]
export DATABASE_USER=''
export DATABASE_PASSWORD=''
export RAILS_ENV=staging
. ~/.zshrc