Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
class baseDog | |
{ | |
public $name; | |
} | |
class dog | |
{ | |
protected $name; |
[alias] | |
etat = status | |
pousser = push | |
tirer = pull | |
commettre = commit | |
ranger = stash | |
ajouter = add | |
enlever = rm | |
cloner = clone | |
fusionner = merge |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
WAL-E needs to be installed on all machines, masters and slaves.
Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf
is:
archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
#!/usr/bin/python | |
# Light painting / POV demo for Raspberry Pi using | |
# Adafruit Digital Addressable RGB LED flex strip. | |
# ----> http://adafruit.com/products/306 | |
import RPi.GPIO as GPIO, Image, time | |
# Configurable values | |
filename = "hello.png" |
#!/bin/bash | |
COMMIT=$1 | |
BRANCH=$2 | |
if [ -z $BRANCH ]; then | |
BRANCH="master" | |
fi | |
perl -ne 'print if ($seen{$_} .= @ARGV) =~ /10$/' \ | |
<(git rev-list --ancestry-path --oneline $COMMIT..$BRANCH) \ |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
/** | |
* This casper scipt checks for 404 internal links for a given root url. | |
* | |
* Usage: | |
* | |
* $ casperjs 404checker.js http://mysite.tld/ | |
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42 | |
*/ | |
/*global URI*/ |
This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)
The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array
it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array
part of it away. So how does that work?
The key here is that objects usually have a predefined set of keys, whereas arrays don't:
package main | |
import ( | |
"log" | |
"net/http" | |
) | |
func redirect(w http.ResponseWriter, r *http.Request) { | |
http.Redirect(w, r, "http://www.google.com", 301) |