Skip to content

Instantly share code, notes, and snippets.

View rianrainey's full-sized avatar

Rian Rainey rianrainey

View GitHub Profile
@rianrainey
rianrainey / yosemite-dev-solutions.md
Last active August 29, 2015 14:08
Solutions to problems encountered after upgrading to Yosemite on my development machine

Development Environment Solutions After Yosemite Upgrade

Can't start rails -s

  • I was missing minitest. By running gem install rails, it installed missing dependencies and thus fixed the minitest error. reference

  • Can't initialize': could not connect to server: Connection refused (PG::Error) reference

cd /usr/local/var/postgres
mkdir pg_tblspc pg_twophase pg_stat_tmp
pgstop
@rianrainey
rianrainey / change_url.sql
Created February 17, 2015 21:11
Update Wordpress URL in database via sql commands
UPDATE wp_options SET option_value = replace(option_value, 'http://dev-families-connect.pantheon.io', 'http://lvh.me:8000') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://dev-families-connect.pantheon.io','http://lvh.me:8000');
UPDATE wp_posts SET post_content = replace(post_content, 'http://dev-families-connect.pantheon.io', 'http://lvh.me:8000');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://dev-families-connect.pantheon.io','http://lvh.me:8000');
@rianrainey
rianrainey / PipeOperator.md
Last active August 29, 2015 14:26
Intro To Elixir
people = DB.find_customers 
orders = Orders.for_customers(people) 
tax = sales_tax(orders, 2013) 
filing = prepare_filing(tax)
filing = prepare_filing(sales_tax(Orders.for_customers(DB.find_customers), 2013))
/* http://css-tricks.com/snippets/css/truncate-string-with-ellipsis/ */
.truncate {
width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@rianrainey
rianrainey / settings.php
Last active December 11, 2015 22:08
Drupal 7 settings.php database snippet
$databases = array (
'default' =>
array (
'default' =>
array (
'database' => 'dbname_db',
'username' => '',
'password' => '',
'host' => '127.0.0.1',
'port' => '',
@rianrainey
rianrainey / Drupal Drush Caching
Last active December 14, 2015 00:09
Drupal Drush Turn Off JS and CSS Caching
drush vset preprocess_css 0 --yes
drush vset preprocess_js 0 --yes
drush cc css-js
=begin
This program calculates the amount to charge a client using Square as a payment processor.
The variation in cost depends largely on if the credit card is present.
=end
puts "--------------------------------------"
puts "---Welcome to the Square Calculator---"
puts "--------------------------------------"
# Output commas in large number
@rianrainey
rianrainey / settings.php
Last active December 15, 2015 13:29
Drupal 7 settings.php to run on Heroku
$url = parse_url(getenv('DATABASE_URL')); // Be sure to run [heroku config:set DATABASE_URL=mysql://db_username:db_password@amazon_rds_instance_name/db_name]
$databases['default']['default'] = array(
// MySQLi uses the mysql driver.
'driver' => $url['scheme'] == 'mysqli' ? 'mysql' : $url['scheme'],
// Remove the leading slash to get the database name.
'database' => substr(urldecode($url['path']), 1),
'username' => urldecode($url['user']),
'password' => isset($url['pass']) ? urldecode($url['pass']) : '',
'host' => urldecode($url['host']),
'port' => isset($url['port']) ? urldecode($url['port']) : '',
@rianrainey
rianrainey / Heroku Master Command
Created March 28, 2013 23:25
How to push a different branch to Heroku as Master because Heroku prefers branches that are master.
git push heroku yourbranch:master
@rianrainey
rianrainey / .wprouter.php
Created May 9, 2013 15:17
Run Wordpress using PHP 5.4's built-in server. This is an attempt to get routing working with Wordpress using PHP 5.4. It works for the non-admin pages. I'm still working on getting it working for Admin pages. It just doesn't reference the CSS properly.
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
set_include_path(get_include_path().':'.__DIR__);
if(file_exists($root.$path))
{
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
$path = rtrim($path,'/').'/index.php';