This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface LoggerInterface { | |
public function __construct($prefix = null); | |
public function log($message); | |
} | |
class Log1 implements LoggerInterface { | |
protected $prefix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This script shows an example of how merge two arrays, | |
* where one array contains instances of Products, and the | |
* second array contains **multiple** instances of Product | |
* Attributes, and where the records in both arrays are | |
* linked via some value ($product->id == $attribute->product_id). | |
*/ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Before: composer require monolog/monolog | |
// composer autoloader | |
require_once 'vendor/autoload.php'; | |
// Shortcuts for simpler usage | |
use \Monolog\Logger; | |
use \Monolog\Formatter\LineFormatter; | |
use \Monolog\Handler\StreamHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* -A in SSH enables agent forwarding. | |
* -p 2122 is not needed if you use the default port of 22. | |
* Replace SSH_USER and example.com with your own values. | |
* Example run: $ envoy run deploy_demo | |
* --no-scripts because Laravel composer.json's post-install-cmd includes optimize, which is already done by php artisan dump-autoload | |
@servers(['test' => '-A -p 2122 -l user test.example.com', 'prod' => '-A -p 2122 -l user example.com']) | |
@task('install_test', ['on' => ['test']]) | |
cd project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Copy ssh public key to rsync.net server: | |
[jim@mb hbdev]$ scp ~/.ssh/id_rsa.pub XXXX@usw-s002.rsync.net:.ssh/authorized_keys | |
Password: | |
id_rsa.pub | |
100% 392 0.4KB/s 00:00 | |
2. Create a local HashBackup backup directory: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Sample data from data.csv | |
//line 1, product 1, feature 1 | |
//line 2, product 1, feature 2 | |
//line 3, product 1, feature 3 | |
//line 4, product 2, feature 1 | |
//line 5, product 3, feature 1 | |
class Product { | |
// Product lines until we save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Cleanup product images | |
# | |
# This will convert images from JPG to PNG and replace the white | |
# background with transparent one. | |
# | |
# This is almost verbatim copy of the script from: | |
# http://tech.natemurray.com/2007/12/convert-white-to-transparent.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- so it turns out that the object tag can act like an iframe | |
but the cool thing is you can nest object tags inside eachother for a fallback path. | |
what this means is you can "objectframe" a site.. and if it fails.. (site down, offline, whatever).. it'll use the next one. | |
so you can objectframe the live site and fallback to a screenshot. | |
or something. | |
demo at : http://jsfiddle.net/paul/CY2FQ/1/ | |
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* For this whole thing to work, you'll need at least these fields in your | |
* articles table: | |
* | |
* - id (article id) | |
* - parent_id (to link drafts to parent article) | |
* - slug (for friendly URLs usually) | |
* - title (obviously) | |
* - content (obviously) |
NewerOlder