Skip to content

Instantly share code, notes, and snippets.

View sam452's full-sized avatar

sam walton sam452

View GitHub Profile
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
<?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;
@sam452
sam452 / .htrouter.php
Last active August 29, 2015 14:11 — forked from bval/.htrouter.php
<?php
/**
* @file
* The router.php for clean-urls when use PHP 5.4.0 built in webserver.
*
* Usage:
*
* php -S localhost:3000 .htrouter.php
*
*/
@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
@sam452
sam452 / system_install.sh
Last active March 18, 2016 14:12
@jfelchner migration for Mac
#!/bin/bash
###
# Helper function for asking the user a question:
#
function ask {
while true; do
if [ "$2" == "Y" ]; then
prompt="Y/n"
default=Y
# 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 }
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
@sam452
sam452 / foo.rb
Created October 17, 2012 19:14 — forked from rick/foo.rb
sample of how instance variables and accessors behave
~ (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