Skip to content

Instantly share code, notes, and snippets.

View remino's full-sized avatar

Rem remino

View GitHub Profile
@remino
remino / get_mask_icon.rb
Last active October 4, 2015 09:32
get_mask_icon: Download SVG file and colour code of a brand made for Safari 9 tab icon
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'open_uri_redirections'
require 'uri'
class GetBrandAssets
attr_accessor :output_dir
@remino
remino / IllustratorSaveAsSVGs.jsx
Created October 3, 2015 03:17 — forked from seltzered/IllustratorSaveAsSVGs.jsx
Quick little script to batch-convert Illustrator .ai's to .svg's, based on Adobe's sample 'save to pdf's' script. Save it to a jsx, and load it under illustrator. Intended for Illustrator CS6.
/**********************************************************
ADOBE SYSTEMS INCORPORATED
Copyright 2005-2010 Adobe Systems Incorporated
All Rights Reserved
NOTICE: Adobe permits you to use, modify, and
distribute this file in accordance with the terms
of the Adobe license agreement accompanying it.
If you have received this file from a source
@remino
remino / sayit.sh
Created August 17, 2015 00:09
sayit: Read lines in a text file with the voice of your choice and output every line in its own .aiff file. (For OS X only.)
#!/bin/sh
sayit_main() {
[ $# -lt 3 ] && sayit_usage && return 1
script="$1"
voice="$2"
outdir="$3"
lineno=1
@remino
remino / getter_setter.js.coffee
Last active August 29, 2015 14:26
Helpers for JavaScript to easily define getters and setters in CoffeeScript
Function::getter = (prop, get) ->
Object.defineProperty @prototype, prop, {get, configurable: yes}
Function::setter = (prop, set) ->
Object.defineProperty @prototype, prop, {set, configurable: yes}
@remino
remino / dig.rb
Last active August 29, 2015 14:23 — forked from re5et/dig.rb
class Hash
def dig(*path)
path.inject(self) do |location, key|
location.is_a?(Hash) ? location[key] : nil
end
end
end
@remino
remino / Gemfile
Created May 22, 2015 02:43
Set up "exception_notification" for Rails 4 on staging at Heroku
group :staging do
gem 'exception_notification'
end
Sass::Engine::DEFAULT_OPTIONS[:load_paths].tap do |load_paths|
load_paths << "#{Rails.root}/app/assets/stylesheets"
load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets"
load_paths << "#{Gem.loaded_specs['html5-boilerplate'].full_gem_path}/stylesheets"
load_paths << "#{Gem.loaded_specs['fancy-buttons'].full_gem_path}/lib/stylesheets"
end
@remino
remino / favicon.sh
Last active August 29, 2015 14:06 — forked from lavoiesl/favicon.sh
#!/bin/bash
# Converts an image in a multi-resolution favicon
# Requires Imagemagick
if [[ "$#" != "2" ]]; then
echo "Usage: $0 input.png output.ico" >&2
exit 1
fi
input="$1"
@remino
remino / compression.rb
Created September 3, 2014 03:58
Ruby on Rails: Minify HTML, CSS, & JS, and compress with gzip https://remino.net/rails-html-css-js-gzip-compression/
# config/initializers/compression.rb
Rails.application.configure do
# Use environment names or environment variables:
# break unless Rails.env.production?
break unless ENV['ENABLE_COMPRESSION'] == '1'
# Strip all comments from JavaScript files, even copyright notices.
# By doing so, you are legally required to acknowledge
# the use of the software somewhere in your Web site or app:
@remino
remino / jstnow.py
Created August 2, 2014 01:09
Python: Print date & time in JST time zone without pytz module
# Print date & time in JST time zone
# For Python 2.7.x without pytz module
import datetime
from datetime import datetime, timedelta, tzinfo
class JST(tzinfo):
def utcoffset(self, dt):
return timedelta(hours=9)