This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
# Call grep, with stdin closed if it is a terminal. | |
# | |
# Avoids the "eternal wait" problem when you've forgotten | |
# to specify a filename. | |
function grep { (tty -s && exec <&-; exec $(which grep) "$@"); } |
/** | |
* Annoying.js - How to be an asshole to your users | |
* | |
* DO NOT EVER, EVER USE THIS. | |
* | |
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com) | |
* Visit https://gist.github.com/767982 for more information and changelogs. | |
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog | |
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors | |
* |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
module Carrierwave | |
module DelayedVersions | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def delayed_versions | |
@delayed_versions ||= Set.new | |
end | |
def delayed_version(name, opts = {}, &block) |
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
# Gemfile | |
gem 'kramdown' |
This is how to copy your files from a given git branch to a new empty branch, using a squash merge.
This example will copy files from branch old-branch
to target-branch
# First be sure, that you don't have uncommitted working changes. They will be deleted
# Checkout a new empty branch without history
git checkout --orphan target-branch
# frozen_string_literal: true | |
class ApplicationPolicy | |
attr_reader :user, :record | |
def initialize(user, record) | |
@user = user | |
@record = record | |
end |
require "bundler/inline" | |
gemfile do | |
source 'https://rubygems.org' | |
gem "rspec", "~> 3.10" | |
end | |
require "rspec/autorun" | |
RSpec.configure do |config| |
# To prevent Rekordbox from starting during boot | |
: > ~/Library/LaunchAgents/com.pioneerdj.rekordboxdj.agent.plist && chflags uchg ~/Library/LaunchAgents/com.pioneerdj.rekordboxdj.agent.plist | |
# To undo the change | |
chflags nouchg ~/Library/LaunchAgents/com.pioneerdj.rekordboxdj.agent.plist |