Note: this rough draft has turned into https://github.com/maxogden/art-of-node#art-of-node
go to https://github.com/maxogden/art-of-node#art-of-node to view the newer versions of this document
// Prints out a Code 39 barcode in HTML/CSS | |
// $string should be a Code 39-compliant string to encode. | |
// Any characters not in the array below will be discarded. | |
function print_code39_barcode($string) { | |
$code39 = array( | |
'0'=>'NnNwWnWnN', '1'=>'WnNwNnNnW', | |
'2'=>'NnWwNnNnW', '3'=>'WnWwNnNnN', | |
'4'=>'NnNwWnNnW', '5'=>'WnNwWnNnN', | |
'6'=>'NnWwWnNnN', '7'=>'NnNwNnWnW', | |
'8'=>'WnNwNnWnN', '9'=>'NnWwNnWnN', |
RewriteEngine On | |
# Removes index.php | |
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /index.php/$1 | |
# Depends on your web host and setup, check with your web host specific settings | |
RewriteCond %{ENV:SECURE_REDIRECT} !=on |
{ | |
"require": { | |
"lncd/oauth2-facebook": "*", | |
"slim/slim": "2.*" | |
}, | |
"minimum-stability": "dev" | |
} |
go to https://github.com/maxogden/art-of-node#art-of-node to view the newer versions of this document
{ | |
"require": { | |
"laravel/framework": "4.0.*", | |
}, | |
"require-dev": { | |
"behat/behat": "2.4.*", | |
"mockery/mockery": "0.7.*", | |
"fzaninotto/Faker": "1.2.*", | |
"pdepend/pdepend" : "1.1.*", |
<?php | |
class Foo | |
{ | |
private $_em; | |
public function __construct($entity_manager) | |
{ | |
$this->_em = $entityManager; | |
} |
<?php | |
// Option 1: the follow method immediately references the relationship and saves it. | |
class User extends Eloquent { | |
public function follows() | |
{ | |
return $this->belongsToMany(self::class, 'follows', 'follower_id', 'followed_id'); | |
} |
VAGRANTFILE_API_VERSION = "2" | |
path = "#{File.dirname(__FILE__)}" | |
require 'yaml' | |
require path + '/scripts/homestead.rb' | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
Homestead.configure(config, YAML::load(File.read(path + '/Homestead.yaml')), Vagrant.has_plugin?('vagrant-hostsupdater')) | |
end |
angular.module("MyApp", ["SocketProvider"]) | |
.controller("MyController", ["$scope", "socket", function($scope, socket) { | |
// Fetch initial data | |
$scope.person = null; | |
socket.get("/person/1").success(function(data) { | |
$scope.person = data; | |
}).error(function() { |
<?php | |
class Bcrypt | |
{ | |
private $rounds; | |
public function __construct($rounds = 12) | |
{ | |
if (CRYPT_BLOWFISH != 1) { | |
throw new Exception("bcrypt not supported in this installation. See http://php.net/crypt"); | |
} |