Skip to content

Instantly share code, notes, and snippets.

@gmanricks
gmanricks / .htaccess
Created January 3, 2013 19:34
.htaccess file for the PHP version of Ribbit ( http://net.tutsplus.com/tutorials/php/building-ribbit-in-php/ )
RewriteEngine On
RewriteRule ^/?Resource/(.*)$ /$1 [L]
RewriteRule ^$ /home [redirect]
RewriteRule ^([a-zA-Z]+)/?([a-zA-Z0-9/]*)$ /app.php?page=$1&query=$2 [L]
@gmanricks
gmanricks / .htaccess
Last active December 10, 2015 14:18
.htaccess file for server's root directory, made for ribbit's PHP implementation NetTuts
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /ribbit/$1
@gmanricks
gmanricks / block.tpl.php
Created January 9, 2013 20:42
Wrap first word with span
<?php
echo "<span>" . preg_replace('/ /', '</span> ', $block->subject, 1);
@gmanricks
gmanricks / Laravel_4.0_Guide.md
Last active December 13, 2015 22:19
Hi Joe, This is what worked for me, hope it helps

#Installing Laravel 4

###Step 1 Download the zip archive from Laravel Downloads Click the ZIP for the 4.0 Version

###Step 2 Extract the Archive into your fortrabbit folder and run composer install.

###Step 3 Make sure that in Fortrabbit you have the composer trigger turned on under the Git settings tab.

@gmanricks
gmanricks / backbone_ccovey.md
Created March 11, 2013 21:06
Here are the options I would initially try :)

Option A

One option is to add a function per model view that checks if any of the fields have been modified and then save itself if it is the case.

So in your timesheet view you would add a function like

'reconcilliate' : function () {
  if(this->$el->find('#punch_date').val() != this.model.get('punchdate')){
 //data has changed
<?php
try
{
$conn = connectToDatabase($credentials);
}
catch (NoDbAtThatUriException $e)
{
//handle it
}
catch (LoginException $e)
@gmanricks
gmanricks / ImageBatchProgram.php
Last active December 15, 2015 05:29
Using Exceptions for Code Flow
<?php
Class Image //Represents a single image file
{
public $type;
public $uri;
public function __construct($pathToImage)
{
$this->uri = $pathToImage;

Git Quick Guide

Hey Pierce, this is not really a tutorial more like a guide on how - at least - I use GIT. I'm going to assume you have GIT installed on your computer.

Creating a new repository

As you may now GIT 'projects' are called repositories, to get one on your computer you basicly have two options.

Clone an existing repo

<?php phpinfo(); ?>
#!/usr/bin/php
<?php
define("CLIENT_ID", "297cf352e9dc1c8237a2");
define("CLIENT_SECRET", "517cf1a00237974b9c5cd50a516e5a674160c4f0");
$token = getToken();
if ($token) {
if (getopt("h", array("help"))) {