Skip to content

Instantly share code, notes, and snippets.

View m4tthumphrey's full-sized avatar
🏂
Working...

Matt Humphrey m4tthumphrey

🏂
Working...
View GitHub Profile
macbook:~ matt$ brew install mysql \
> && sudo mkdir -p /Library/LaunchAgents \
> && sudo cp LaunchAgents/homebrew.mxcl.mysql.plist /Library/LaunchAgents/ \
> && sudo launchctl load /Library/LaunchAgents/homebrew.mxcl.mysql.plist \
> && sudo mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
==> Installing mysql dependency: cmake
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/cmake-2.8.10.1.mountainlion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring cmake-2.8.10.1.mountainlion.bottle.tar.gz
/usr/local/Cellar/cmake/2.8.10.1: 683 files, 32M
macbook:osx-stack matt$ brew install /usr/local/LibraryAlt/duplicates/php.rb --with-fpm --with-mysql
==> Downloading http://www.php.net/get/php-5.3.10.tar.bz2/from/this/mirror
Already downloaded: /Library/Caches/Homebrew/php-5.3.10
==> Patching
patching file ext/tidy/tidy.c
patching file ext/mssql/php_mssql.h
Hunk #1 succeeded at 70 (offset 5 lines).
==> ./configure --prefix=/usr/local/Cellar/php/5.3.10 --with-config-file-path=/usr/local/etc --with-config-file-scan-dir=/
Warning: inreplace in 'Makefile' failed
Expected replacement of 'INSTALL_IT = $(mkinstalldirs) '$(INSTALL_ROOT)/usr/libexec/apache2' && $(mkinstalldirs) '$(INSTALL_ROOT)/private/etc/apache2' && /usr/sbin/apxs -S LIBEXECDIR='$(INSTALL_ROOT)/usr/libexec/apache2' -S SYSCONFDIR='$(INSTALL_ROOT)/private/etc/apache2' -i -a -n php5 libs/libphp5.so' with 'INSTALL_IT = $(mkinstalldirs) '/usr/local/Cellar/php/5.3.10/libexec/apache2' && $(mkinstalldirs) '$(INSTALL_ROOT)/private/etc/apache2' && /usr/sbin/apxs -S LIBEXECDIR='/usr/local/Cellar/php/5.3.10/l
@m4tthumphrey
m4tthumphrey / error
Last active December 10, 2015 12:28
Exception
NoMethodError
Error
undefined method `id' for nil:NilClass
/home/gitlab/gitlab/app/models/project.rb:104:in `find_with_namespace'
/home/gitlab/gitlab/app/workers/post_receive.rb:9:in `perform'
class PermittedParams < Struct.new(:params, :user)
def topic
params.require(:topic).permit(*topic_attributes)
end
def topic_attributes
[:name].tap do |attributes|
attributes << :sticky if user && user.admin?
attributes << {posts_attributes: {:"0" => post_attributes}}
end
class Feature < ActiveRecord::Base
has_many :product_features
has_many :products, :through => :product_features
attr_accessible :name
end
class Product < ActiveRecord::Base
belongs_to :company
has_many :features,
:class_name => 'ProductFeature',
:source => :product_feature,
:include => :feature
attr_accessible :description,
:name,
var a = [];
function addPart(part) {
someFunction('blah', function(var) {
alert(a.length); // correct value: 0, 1, 2
a.push(part);
});
}
function init()
{
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar -xvzf ruby-1.9.3-p392.tar.gz
cd ruby-1.9.3-p392/
./configure --prefix=/usr/local
make
make install
@m4tthumphrey
m4tthumphrey / Config.php
Created April 23, 2013 13:37
One of the worst parts of Magento. Truly hilarious. It checks that a URL returns the string 'MAGENTO' and nothing else as a way to check that it has been installed to the correct place. Impossible to test.
<?php
protected function _checkUrl($url, $secure = false)
{
$prefix = $secure ? 'install/wizard/checkSecureHost/' : 'install/wizard/checkHost/';
try {
$client = new Varien_Http_Client($url . 'index.php/' . $prefix);
$response = $client->request('GET');
/* @var $responce Zend_Http_Response */
$body = $response->getBody();
# Backup and Swap Files
.*.sw?
*.bak
*~
# Komodo
*.komodoproject
.komodotools
# PHPStorm