This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
#!/bin/bash | |
echo "Usage bin/neo4j-cli [path/to/db] [host-or-ip] [port]" | |
DIR=${0%%neo4j-cli} | |
DB=${1-data/graph.db} | |
IP=${2-127.0.0.1} | |
PORT=${3-7474} | |
CONFIG=${DIR}../conf/neo4j-server.properties |
#!/bin/bash | |
# usage neo.sh [-h host:port] [-u user:pass] [cmd] | |
# end cypher statements with semicolon | |
# terminate read loop with ^d or return | |
HOST="localhost:7474" | |
if [ "$1" == "-h" ]; then | |
shift; HOST="$1";shift; | |
fi | |
AUTH="" |
# put this in your .bash_profile | |
if [ $ITERM_SESSION_ID ]; then | |
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND"; | |
fi | |
# Piece-by-Piece Explanation: | |
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment | |
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too | |
# the $PROMPT_COMMAND environment variable is executed every time a command is run | |
# see: ss64.com/bash/syntax-prompt.html |
// Enter the day you would like to create | |
WITH { day: 18, month: 1, year: 2014 } as dayMap | |
// Merge hours in a day | |
MERGE (thisDay:Day { day: dayMap.day, month: dayMap.month, year: dayMap.year }) | |
MERGE (firstHour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: 1 }) | |
CREATE (thisDay)-[:FIRST]->(firstHour) | |
FOREACH (i IN tail(range(1, 24)) | | |
MERGE (thishour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i }) | |
MERGE (lasthour:Hour { day: dayMap.day, month: dayMap.month, year: dayMap.year, hour: i - 1 }) |
<?php | |
class Foo | |
{ | |
protected $foo; | |
protected $bar; | |
protected $baz; | |
} |
<?php | |
namespace Lunetics\TimezoneBundle\Validator; | |
use Symfony\Component\Validator\Constraint; | |
/** | |
* @Annotation | |
*/ | |
class Timezone extends Constraint |
The [RFC for a new simple to use password hashing API][rfc] has just been accepted for PHP 5.5. As the RFC itself is rather technical and most of the sample codes are something you should not use, I want to give a very quick overview of the new API:
Everybody knows that you should be hashing their passwords using bcrypt, but still a surprising number of developers uses insecure md5 or sha1 hashes (just look at the recent password leaks). One of the reasons for this is that the crypt() API is ridiculously hard to use and very prone to programming mistakes.
ExecutionEngine engine = new ExecutionEngine(graphDB); | |
String query = "start n=node:Person(name={name}) | |
match n-[:ACTS_IN]->movie<-[:ACTS_IN]-friend | |
return friend"; | |
ExecutionResult result = engine.query(query, map("name", "Keanu"); | |
for (Map<String,Object> row : result) { | |
Node friend = row.get("friend"); | |
} |
MOCKING DATABASE OPERATIONS | |
=========================== | |
In our webreg example, we refactored some code so that we could | |
pass in our database object instead of creating it inside. Let's | |
push that further and show a slightly advanced usage of a mock | |
object. | |
So let's rework our Franchise test to use a mocked database connection. |