Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Oglesby ryanoglesby08

View GitHub Profile
@ryanoglesby08
ryanoglesby08 / server.js
Created May 31, 2017
A node.js SPA server that serves static files and an index.html file for all other routes.
View server.js
/*
Incredibly simple Node.js and Express application server for serving static assets.
Given as an example from the React Router documentation (along with examples
using nginx and Apache):
- https://github.com/ReactTraining/react-router/blob/master/docs/guides/Histories.md#browserhistory
*/
const express = require('express');
const path = require('path');
@ryanoglesby08
ryanoglesby08 / git_rubocop.rake
Created Feb 26, 2015
A rake task to run rubocop on changed ruby files in a git repository. Meant to be run as part of a pre-commit task.
View git_rubocop.rake
desc 'Run Rubocop on uncommitted changed files'
task :git_rubocop do
RUBY_FILENAME_PATTERNS = %w(Gemfile Rakefile .rb .rake)
def ruby_file?(filename)
RUBY_FILENAME_PATTERNS.each do |pattern|
return true if filename.include? pattern
end
false
end
You can’t perform that action at this time.