Skip to content

Instantly share code, notes, and snippets.

View johntron's full-sized avatar

John Syrinek johntron

View GitHub Profile
console doctrine:database:drop --force
console doctrine:database:create
console doctrine:schema:create
console doctrine:fixtures:load
{% if app.session.hasFlash('notice') %}
<div class="flash-notice notice">
<div class="wrapper">{{ app.session.flash('notice') }}</div>
</div>
{% endif %}
{% if app.session.hasFlash('warning') %}
<div class="flash-notice warning">
<div class="wrapper">{{ app.session.flash('warning') }}</div>
</div>
{% endif %}
<?php
/**
* Splash Media
*
* LICENSE
*
* This file is intellectual property of Splash Media and may not
* be used without permission.
*
* @category Splash Media
@johntron
johntron / gist:1409746
Created November 30, 2011 16:43
Remove blank fields from a bound form
<?php
// ...
$formData = $request->request->get('splashmedia_bundle_oxygenbundle_usertype');
if ( 0 === strlen( $formData['expiresAt']['date']['year'] ) ) {
$editForm->remove( 'expiresAt' );
unset( $formData['expiresAt']);
}
if ( 0 === strlen( $formData['passwordRequestedAt']['date']['year'] ) ) {
$editForm->remove( 'passwordRequestedAt' );
unset( $formData['passwordRequestedAt']);
Mar 24 10:13:14 syslogd started: BusyBox v1.19.3
Mar 24 10:13:14 kernel: klogd started: BusyBox v1.19.3 (Ubuntu 1:1.19.3-7ubuntu1)
Mar 24 10:13:14 kernel: [ 0.000000] Initializing cgroup subsys cpuset
Mar 24 10:13:14 kernel: [ 0.000000] Initializing cgroup subsys cpu
Mar 24 10:13:14 kernel: [ 0.000000] Linux version 3.5.0-17-generic (buildd@allspice) (gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) ) #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 (Ubuntu 3.5.0-17.28-generic 3.5.5)
Mar 24 10:13:14 kernel: [ 0.000000] Command line: BOOT_IMAGE=/install/vmlinuz file=/cdrom/preseed/ubuntu-server.seed quiet --
Mar 24 10:13:14 kernel: [ 0.000000] KERNEL supported cpus:
Mar 24 10:13:14 kernel: [ 0.000000] Intel GenuineIntel
Mar 24 10:13:14 kernel: [ 0.000000] AMD AuthenticAMD
Mar 24 10:13:14 kernel: [ 0.000000] Centaur CentaurHauls
$feed = $this->get('feed_parser'); // This is just a SimplePie object
$feed->set_feed_url('http://feeds.feedburner.com/lolcats/rss');
$feed->init();
$items = $feed->get_items();
$item = $items[array_rand($items)];
$item = $item->get_content();
$item = substr($item, 0, strpos($item, 'Posted by'));
<IfModule mod_deflate.c>
# these are known to be safe with MSIE 6
AddOutputFilterByType DEFLATE text/html text/plain text/xml
# everything else may cause problems with MSIE 6
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
AddOutputFilterByType DEFLATE application/rss+xml
ExpiresActive On
@johntron
johntron / add_date_strings.js
Created May 29, 2013 16:04
For a collection of subdocuments, adds a human-friendly date string using an existing timestamp
var coll = '101.google.youtube';
var r = db[coll].find({"$where": "typeof this.statistics_log != 'undefined' && this.statistics_log.length > 0"});
while (r.hasNext()) {
var d = r.next();
for(var i = 0, j = d.statistics_log.length; i < j; i++) {
var execute_at = new Date(d.statistics_log[i].execute_at_ts * 1000);
d.statistics_log[i].execute_at = execute_at.toString();
}
print(db[coll].update({"_id": d._id}, d));
}
vagrant@cube:~$ sudo dpkg -i nginx_1.5.2-1~raring_amd64.deb
Selecting previously unselected package nginx.
(Reading database ... 67542 files and directories currently installed.)
Unpacking nginx (from nginx_1.5.2-1~raring_amd64.deb) ...
----------------------------------------------------------------------
Thanks for using NGINX!
Check out our community web site:
* http://nginx.org/en/support.html
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $network $remote_fs $local_fs
# Required-Stop: $network $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Stop/start nginx
### END INIT INFO