⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
<?php | |
// get fb likes from fb graph api | |
// put this block in single.php, or somewhere you have $post and have setup postdata [inside a Loop] | |
$obj = json_decode( file_get_contents( 'http://graph.facebook.com/?id='.get_permalink() ) ); | |
$likes = $obj->shares; | |
update_post_meta($post->ID, '_fb_likes', $likes, false); | |
// make a Loop [in a template page or whatever] to query and display posts ordered by fb like popularity | |
$args = array( |
<?php | |
namespace Madapaja\ODM\MongoDB\Tests; | |
use Doctrine\ODM\MongoDB\Configuration; | |
/** | |
* Base testcase class for MongoDB ODM testcases. | |
* | |
* Usage: |
<?php | |
require_once __DIR__ . '/../lib/vendor/Silex/silex.phar'; | |
$app = new Silex\Application(); | |
$app['debug'] = true; | |
// Registering Symfony\Yaml and Symfony\Config | |
$app['autoloader']->registerNamespace('Symfony', __DIR__.'/../lib/vendor/symfony/src'); |
This gist assumes:
- you have a local git repo
- with an online remote repository (github / bitbucket etc)
- and a cloud server (Rackspace cloud / Amazon EC2 etc)
- your (PHP) scripts are served from /var/www/html/
- your webpages are executed by apache
- apache's home directory is /var/www/
I've collected all the links related to Backbone.js that I find useful. Most of these are well-built projects and epic guides (not ephemeral blog posts.) Please feel free to fork and even contribute.
before_script: | |
- ./path/to/mongo-php-driver-installer.sh |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open and able to receive traffic. | |
This first command will scan all of the UDP ports from 1 to 65535 and add the results to a text file: | |
$ nc -vnzu server.ip.address.here 1-65535 > udp-scan-results.txt | |
This merely tells you that the UDP ports are open and receive traffic. | |
Perhaps a more revealing test would be to actually transfer a file using UDP. |
Until last night I lived in fear of tildes, carats, resets and reverts in Git. I cargo culted, I destroyed, I laid waste the tidy indicies, branches and trees Git so diligently tried to maintain. Then Zach Holman gave a talk at Paperless Post. It was about Git secrets. He didn't directly cover these topics but he gave an example that made me realize it was time to learn.
Generally, when I push out bad code, I panic, hit git reset --hard HEAD^
, push and clean up the pieces later. I don't even really know what most of that means. Notational Velocity seems to be fond of it ... in that I just keep copying it from Notational Velocity and pasting it. Turns out, this is dumb. I've irreversibly lost the faulty changes I made. I'll probably even make the same mistakes again. It's like torching your house to get rid of some mice.
Enter Holman. He suggests a better default undo. git reset --soft HEAD^
. Says it stag