brew install mongodb
Set up launchctl to auto start mongod
$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
/usr/local/opt/mongodb/
is a symlink to /usr/local/Cellar/mongodb/x.y.z
(e.g., 2.4.9
)
# Add to nginx.conf http section | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} |
from fpdf import FPDF | |
import re | |
import os | |
""" | |
Generate many files based on a tuple of data for sample. | |
@gist https://gist.github.com/silasrm/ff4733ecfa6bf1c6782c3513b89f10c4 | |
@version 0.1 | |
""" |
#!/bin/sh | |
version="2.6.3" | |
priority="20603" | |
sudo mkdir -p /var/redis /var/log/redis | |
curl -sL http://redis.googlecode.com/files/redis-${version}.tar.gz | tar zx | |
cd redis-${version}/ | |
make | |
sudo make PREFIX=/usr/local/redis/${version} install |
//1. Generate a random string: | |
Math.random().toString(36).substr(2); | |
//This simply generates a random float, casts it into a String using base 36 and remove the 2 first chars 0 and .. | |
//2. Clone an array: | |
var newA = myArray.slice(0); | |
//This will return a copy of the array, ensuring no other variables point to it. | |
//3. Remove HTML tags: | |
"<b>A</b>".replace(/<[^>]+>/gi, ""); |
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
This is the how to for redirection implementation by roles after login or logout in Symfony2
AfterLoginRedirection.php
and AfterLogoutRedirection.php
to your bundle under the "Redirection" directoryservices.yml
file in your bundle and copy/paste the content of services.yml
security.yml
file...success_handler: redirect.after.login
in form_login:
sectionsuccess_handler: redirect.after.logout
in logout:
section<?php | |
use Doctrine\ORM\Persisters; | |
class DoctrineHelper | |
{ | |
protected $entityManagers = array(); | |
public function bulkCommit(EntityManager $em, array $entities) | |
{ |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php | |
*/ | |
$args = array( |