This setup will allow you to precompile assets locally and keep them separated depending on the environment. To precompile assets locally run RAILS_ENV=production COMPILE_ASSETS=1 rake assets:precompile
. Using an ENV var like this removes the need for having therubyracer or some other javascript engine on your server instances since they aren't actually running the precompilation task.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
editor | |
foreground: F8F8F8 | |
background: 141414 | |
caret: A7A7A7 | |
editor-selection | |
background: 33363a | |
COMMENT | |
foreground: 5F5A60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$phone: '(max-width: 480px)'; | |
$tablet-portrait: '(max-width: 767px)'; | |
$tablet-landscape-desktop: '(min-width: 768px) and (max-width: 979px)'; | |
$large-desktop: '(min-width: 1200px)'; | |
$non-retina: 'screen and (-webkit-max-device-pixel-ratio: 1)'; | |
$retina: 'screen and (-webkit-min-device-pixel-ratio: 2)'; | |
@mixin respond-to($media) { | |
@media #{$media} { | |
@content; |
sudo mv toggleAirport.sh /Library/Scripts/
sudo chmod 755 /Library/Scripts/toggleAirport.sh
sudo mv com.mine.toggleairport.plist /System/Library/LaunchAgents/
sudo chown root:wheel /System/Library/LaunchAgents/com.mine.toggleairport.plist
sudo launchctl load /System/Library/LaunchAgents/com.mine.toggleairport.plist
The script should run on startup and give you growl notifications when airport status is changed if you have GrowlNotify installed
Credit to www.georges.nu/blog/2011/06/how-to-automatically-turn-off-airport-when-ethernet-is-plugged-in/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT p.id, | |
sum(quantity) AS num_sold | |
FROM spree_orders o | |
JOIN spree_line_items li ON o.ID = li.order_id | |
JOIN spree_variants v ON li.variant_id = v.id | |
JOIN spree_stock_items i ON v.id = i.variant_id | |
JOIN spree_products p ON v.product_id = p.id | |
WHERE o.state = 'complete' | |
GROUP BY p.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def range_within_bounds(range, min, max) | |
min ||= range.min | |
max ||= range.max | |
[range.min, min].max .. [range.max, max].min | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def changelog_for_gem(gem) | |
changelogs = `bundle exec gem contents #{gem}`.lines.grep(/history|changelog|news/i) | |
if changelogs.empty? | |
puts "No changelog found for gem #{gem}" | |
return nil | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Usage: dedup-imovie-library LIBRARY ORIGINALS | |
# | |
# Goes through an iMovie 10 library and replaces all the "Original Media" with | |
# symlinks to the actual original media, in order to conserve disk space. Note | |
# that because they're symlinks, if the path to the originals changes (e.g. you | |
# rename the external drive they are on) then the links will be broken. | |
# | |
# This assumes you've already imported the files into iMovie and waited for them |
OlderNewer