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
~ (master)(*)$ irb | |
>> | |
>> class Foo | |
>> attr_accessor :read_write | |
>> attr_reader :readonly | |
>> attr_writer :writeable | |
>> | |
?> def initialize(read_write, readonly, writeable) | |
>> @read_write = read_write | |
>> @readonly = readonly |
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
require 'rubygems' | |
require 'test/unit' | |
require 'em-http' | |
require 'vcr' | |
VCR.config do |c| | |
c.cassette_library_dir = 'fixtures/vcr_cassettes' | |
c.http_stubbing_library = :webmock | |
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
# t.string "key" | |
# t.string "val" | |
class MyConfig < ActiveRecord::Base | |
class << self | |
def all_as_hash | |
begin | |
Rails.cache.fetch(:my_config_hash) do | |
h = {} | |
all.each { |m| h[m.key] = m.val } |
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 | |
### | |
# Helper function for asking the user a question: | |
# | |
function ask { | |
while true; do | |
if [ "$2" == "Y" ]; then | |
prompt="Y/n" | |
default=Y |
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
@echo off | |
cd f:\ | |
ECHO "moved" | |
ECHO "think I got the capture" | |
for /f "tokens=2-8 delims=.:/ " %%a in ("%date% %time%") do set Timestamp=%%c-%%a-%%b_%%d-%%e-%%f | |
ECHO %Timestamp% | |
for /f "tokens=1-8 delims=&" %%a in ('heroku pgbackups:url --app gw-inspector') do @set this_url=%%a | |
for /f "tokens=2 delims=&" %%b in ('heroku pgbackups:url --app gw-inspector') do @set b_url=%%b | |
for /f "tokens=3 delims=&" %%c in ('heroku pgbackups:url --app gw-inspector') do @set c_url=%%c |
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
<?php | |
/** | |
* @file | |
* The router.php for clean-urls when use PHP 5.4.0 built in webserver. | |
* | |
* Usage: | |
* | |
* php -S localhost:3000 .htrouter.php | |
* | |
*/ |
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
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use App\Http\Requests; | |
use App\Http\Controllers\Controller; | |
use Cache; | |
// use Zendesk\API\HttpClient as Zendesk; | |
use Flash; |
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
phpbrew -d ext install gd -- --with-libdir=lib/x86_64-linux-gnu --with-gd=shared --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr/include/freetype2/ft2build.h --with-xpm-dir=/usr |