Skip to content

Instantly share code, notes, and snippets.

View toolmantim's full-sized avatar
:shipit:
🎉

Tim Lucas toolmantim

:shipit:
🎉
View GitHub Profile
@toolmantim
toolmantim / Gemfile
Last active August 29, 2015 13:57
Rails sessions + Sinatra sessions = kaboom
source "https://rubygems.org/"
gem "rails", "~> 4.0"
gem "sinatra", "~> 1.4"
gem "puma"
@toolmantim
toolmantim / Animated-Aminals.markdown
Created October 23, 2013 09:17
A Pen by Tim Lucas.
@toolmantim
toolmantim / host_based_tld_length.rb
Last active November 18, 2020 17:23
Reconfigures Rails ActionDispatch's TLD handling dynamically based on the request host, so you don't have to mess with config.action_dispatch.tld_length for cross-device testing using xip.io and friends
# Reconfigures ActionDispatch's TLD handling dynamically based on the request
# host, so you don't have to mess with config.action_dispatch.tld_length for
# cross-device testing using xip.io and friends
#
# Examples:
# use Rack::HostBasedTldLength, /xip\.io/, 5
class Rack::HostBasedTldLength
def initialize(app, host_pattern, host_tld_length)
@app = app
@toolmantim
toolmantim / Makefile
Last active August 21, 2024 20:56
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
@toolmantim
toolmantim / sass_css_importer.rb
Last active March 9, 2016 20:03
A SASS extension which allows you to import CSS files just as you do SCSS and SASS files. Super handy for bower and related tools.
require 'sass/importers'
# = SASS CSS Importer
#
# This overrides the Filesystem importer, which is used by Sass to @import
# .sass and .scss files from the filesystem, to include .css files as well.
#
# Once require'd, you can import a "some-stylesheet.css" file by simply doing:
#
# @import "some-stylesheet";
@toolmantim
toolmantim / pinjs.js
Created May 13, 2013 12:34
First cut at a Pin Payments Javascript API loader for require.js
define(function() {
/*
Require.js loader plugin for the Pin Payments Javascript API
Firstly, ensure that your <html> element has the following attributes set:
data-pin-api - either "test" or "live"
data-pin-publishable-key - your Pin publishable API key
@toolmantim
toolmantim / Gruntfile.js
Created May 12, 2013 00:18
If you're using SASS, Grunt and Bower you may wonder "How do I @import the CSS file from a bower component I just installed?" Well I'm afraid you're asking the wrong question—@import is really only designed to import SCSS files (for now). But there is hope! grunt-contrib-sass also supports concatenation, and to use it simply include the CSS file…
module.exports = function(grunt) {
grunt.initConfig({
// ...
sass: {
styles: {
files: {
'sass/styles.css': [
'components/normalize-css/normalize.css',
@toolmantim
toolmantim / 😫.md
Created April 5, 2013 06:19
The OpsWorks dashboard

Using the OpsWorks dashboard after it's been left for a day:

to which I say:

and then proceed to:

@toolmantim
toolmantim / Opsworks Overview.markdown
Last active August 2, 2017 12:35
After messing with OpsWorks for a few days I thought I'd document my own introduction to it's most important bits.

OpsWorks

AWS OpsWorks, formerly Scalarium, is a chef-based system that deeply integrates with EC2 (security policies, key pairs, etc). OpsWorks acts as web console to configure your entire system, and as a command hub for running chef-solo on all the instances.

Stacks

A stack represents a collection of inter-connected and inter-configured services.

A stack has lifecycle events which are triggered by any change to the stack configuration (such as, adding a new instance to a layer, or changing the hosts of an application). In this way, the stack acts as an event hub, notifying every instance of any changes.