Skip to content

Instantly share code, notes, and snippets.

@lukearmstrong
lukearmstrong / generate_migrations_config.php
Created October 22, 2012 15:33
Generate Migrations Config file from the database
<?php
namespace Fuel\Tasks;
class Generate_Migrations_Config
{
public function run()
{
// Backup the migrations.php config files, wherever the hell they may be.
$this->backupConfig();
@lukearmstrong
lukearmstrong / install-node-js.sh
Last active August 2, 2022 18:59
Install node.js from source on CentOS/RHEL
yum install gcc-c++ make openssl-devel python26
cd /usr/local/src/
wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz
tar zxvf node-v0.10.28.tar.gz
cd node-v0.10.28/
export PYTHON=/usr/bin/python26
$PYTHON ./configure
make
make install
mysqldump -h server -u user -p database_name --single-transaction | pv | mysql -h other_server other_database
@lukearmstrong
lukearmstrong / build.xml
Created November 19, 2012 11:07
Ant build script for SASS
<?xml version="1.0" ?>
<project default="default" basedir=".">
<target name="default" depends="load.properties, sass" />
<target name="load.properties">
<echo>-- Initialize Variables</echo>
<!-- Hopefully the line below is the only one you need to change -->
<property name="template.path" value="public/assets/templates/PUT-YOUR-TEMPLATE-FOLDER-NAME-HERE" />
@lukearmstrong
lukearmstrong / install-ruby.sh
Last active June 19, 2017 10:11
Install enough to get Ruby and Sass working on RHEL/CentOS
# lol redhat
su
# Install deps
yum install libyaml libyaml-devel openssl libxml2-devel bison libxslt-devel openssl-devel tcl tk libffi tcl-devel tk-devel libffi-devel
# Download Ruby
cd /usr/local/src/
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -xvzf ruby-1.9.3-p392.tar.gz
21000!
Fuel\Core\Database_Exception [ 21000 ]: SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s) with query: "SELECT * FROM `sessions` WHERE `session_id` = ('c63d2f600257e36a254875f39b67b566', '02b361970430331152f27f0aae1785f3', '7bffeaaadb74ac6dc719b47cffd7ac32', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11', 1354730073, 1354730248)"
COREPATH/classes/database/pdo/connection.php @ line 175
@lukearmstrong
lukearmstrong / gist:4620141
Created January 24, 2013 11:12
forward port bugs onto minor
<MrAlanSir> right what whealer says seems portable
<MrAlanSir> so you 1) git co -b feature-forwardport bugs
<MrAlanSir> This makes the feature-forwardport branch at the end of the bugs branch
<MrAlanSir> Then you 2) git rebase --onto minor $hash feature-forwardport
<MrAlanSir> And to find $hash you look at git lg and find the start of what you consider to be the stuff you want
<MrAlanSir> which is probably going to be the last-tagged minor version since that's where bugs branches are based
<MrAlanSir> but you might already have some bugs forward-ported so that's not universally true
<MrAlanSir> Then you'll have a feature-forwardport branch containing all the bugfix commits
<MrAlanSir> and it'll be based on minor
<MrAlanSir> throw a -p into that rebase to keep the lumps
@lukearmstrong
lukearmstrong / gist:4672431
Last active December 11, 2015 22:49
forward port bugs onto minor
git co -b feature-forwardport bugs
git rebase -p --onto minor $HASH feature-forwardport
git close -d -r $PULL_REQUEST_ID minor
git push origin minor
@lukearmstrong
lukearmstrong / rvm.sh
Last active December 12, 2015 08:49
Install RVM and Ruby 1.9.3 system wide on Ubuntu 12.04 LTS
curl -L https://get.rvm.io | sudo bash -s stable
sudo usermod -a -G rvm lukea
# Terminal > Edit > Profile Preferences > Title and Command > Run command as a login shell
# logout
# login
rvm list known
rvm install 1.9.3
rvm use 1.9.3 --default
* 861866e (HEAD, tag: v1.2.0, origin/master, origin/HEAD, master) feature-d merged into master; resolves #5
|\
| * bb5a0c1 adding Feature D
|/
* e43c9f0 bug-a merged into master; resolves #4
|\
| * 8f782bd fixing bug A
|/
* c2f9fe1 feature-c merged into master; resolves #3
|\