Skip to content

Instantly share code, notes, and snippets.

View deletosh's full-sized avatar

Dele Tosh deletosh

View GitHub Profile
#! /bin/sh
TEMPFILE=`tempfile`
cat /var/log/installer/initial-status.gz | gzip -d |grep '^Package:' | awk '{ print $2}' > $TEMPFILE
aptitude search -F %p '~i!~M' | awk '{ print $1}' | grep -v -F -f $TEMPFILE
rm $TEMPFILE

How to use MAMP with the mysql2 gem and Ruby 1.9.3-p194 via rbenv

Let's say you're a web developer who happens to work with both MAMP and Ruby when building different types of websites. Let's say you also like to keep your MySQL stuff in one place and don't like having to juggle both a local MySQL install as well as a MAMP MySQL install. Well, you can indeed connect your ruby apps to MAMP's MySQL. Here's a tutorial on how to do it.

Important! Before you do anything, download and install MAMP. MAMP Pro will work as well. At the time of this writing, MAMP 2.1.1 is the latest.

First, install Ruby via rbenv

  1. Install homebrew
  2. Install rbenv: brew install rbenv, follow any instructions homebrew gives you after the installation is complete.
@deletosh
deletosh / LaravelHierarchy
Created May 8, 2013 20:25
Using Closure Table ( for Hierarchical Data -- breadcrumbs, threaded comments, etc ) in Laravel 4 / MySQL
<?php
namespace Geleyi\Helpers;
use Illuminate\Support\Facades\DB;
/**
* Class Hierarchy
*
@deletosh
deletosh / NT+.Em.js
Last active December 16, 2015 03:19
window.App = Em.Application.create({
LOG_TRANSITIONS: true
});
/**
* Data Store
*
*/
App.Store = DS.Store.extend({
revision: 12,
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git add .
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
@deletosh
deletosh / gist:3514072
Created August 29, 2012 15:10
standard website role names
admin //Manage everything
manager //Manage most aspects of the site
editor //Scheduling and managing content
author //Write important content
contributors//Authors with limited rights
moderator //Moderate user content
member //Special user access
subscriber //Paying Average Joe
user //Average Joe
@deletosh
deletosh / autounit.rb
Created July 26, 2012 00:37
Autotest PHPUnit in Laravel
# PHPUnit: http://bit.ly/NYYCWs
# Ruby: http://rubyinstaller.org/ (Mac) *OR* http://rubyinstaller.org/ (Win)
# watchr: gem install watchr
# Growl: http://growl.info/ | http://bit.ly/NYYCWs (Mac) *OR* http://bit.ly/NYYrdF (Win)
# save in same level as 'artisan', then run watchr_imagesr autounit.rb
# src: http://bit.ly/NYZMRT
#watch just the test files (optionally superceeded by the next line)
<?php
require_once 'ControllerTestCase.php';
class AccountControllerTest extends ControllerTestCase
{
public function testSignupWithNoDataRedirectsAndHasErrors()
{
$response = $this->post('account@signup', array());
@deletosh
deletosh / foundation.scss
Created July 16, 2012 17:47
foundation base import file
/***********************************************************************
*
* Uses the foundation framework with stylesheet source in SASS/Compass,
* to install, see: http://bit.ly/McPEag
* @dependancy: Ruby (on windows: DevKit: http://bit.ly/McPL5E)
*
**********************************************************************/
@import "settings";
@import "foundation/base";
@deletosh
deletosh / first-not all.sh
Created July 9, 2012 19:56
being first, but not all
--------------------------------------------------------------------------
I may not be the first,
or the last
or the only.
You might have loved before
You can love again.
If I loves you now, what else matters?
I'm not perfect - you aren't either,
the two of us may never be perfect together