I have a table with millions of rows that needs processing. The type of processing is not really important for this article. We simply need to process some data with Ruby --or any other user-space programming language.
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
#!/bin/sh | |
# Textmate command that uses AppleScript to switch to Firefox, reload | |
# the browser, and then switch back to Textmate | |
# I have this bound to Ctl-Opt-Command R | |
# | |
# Save: Nothing (or Current File is useful too) | |
# Input: None | |
# Output: Discard | |
# |
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 bash | |
# Center the top most window using AppleScript | |
# I call this up quickly using Quicksilver and run it as a terminal | |
# script because (surprise!) it's faster than running as native AppleScript | |
osascript -e " | |
tell application \"Finder\" | |
set screenSize to bounds of window of desktop | |
set screenWidth to item 3 of screenSize | |
end tell |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"forceConsistentCasingInFileNames": true, | |
"noImplicitReturns": true, | |
"strict": true, | |
"noUnusedLocals": true, | |
"strict": true, | |
"declaration": false, | |
"emitDecoratorMetadata": true, | |
"experimentalDecorators": true, |
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 | |
require 'rails/generators' | |
require 'rails/generators/rails/app/app_generator' | |
require "active_support/core_ext/string/strip" | |
class CleverAppGenerator < Rails::Generators::AppGenerator | |
class_option :skip_bundle, default: true | |
class_option :database, default: "postgresql" | |
class_option :skip_test_unit, default: true, hide: true |
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 | |
PROJECT_NAME = "" | |
pages = %w{ | |
... urls to pages go here | |
} | |
pages.each_with_index do |url, index| | |
system("python webkit2png.py -W 1200 -o #{PROJECT_NAME}_#{index} -F #{url}") |
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
"use strict"; | |
class Board { | |
constructor() { | |
this.width = 10; | |
this.height = 12; | |
this.grid = this._initializeToZeros(); | |
this.grid[2][1] = 1; | |
} |
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
# I've always disliked the way deprecation notices would appear while the test | |
# suite is running: they break up the neat little rows of dots (or F's, as it | |
# may be) which causes noise and makes the notices hard to read and understand. | |
# | |
# Adding this snippet to `config/environments/test.rb` will buffer all your | |
# deprecation notices until the end of the test run and keep your test output | |
# nice and tidy. | |
# | |
Rails.application.config do | |
# ... |
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
#!/bin/bash | |
function gitroot { | |
if [ "$(pwd)" != "$(git rev-parse --show-toplevel)" ]; then | |
go-to-git-root | |
elif [ $(cd .. && git rev-parse --is-inside-work-tree &> /dev/null; echo $?) -eq 0 ]; then | |
cd .. && go-to-git-root | |
fi | |
} |
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
# MIT License: | |
# | |
# Copyright (C) 2012 Heroku, Inc. | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of | |
# this software and associated documentation files (the "Software"), to deal in | |
# the Software without restriction, including without limitation the rights to | |
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |
# of the Software, and to permit persons to whom the Software is furnished to do | |
# so, subject to the following conditions: |
NewerOlder