This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Edit this file to introduce tasks to be run by cron. | |
# | |
# Each task to run has to be defined through a single line | |
# indicating with different fields when the task will be run | |
# and what command to run for the task | |
# | |
# To define the time you can provide concrete values for | |
# minute (m), hour (h), day of month (dom), month (mon), | |
# and day of week (dow) or use '*' in these fields (for 'any').# | |
# Notice that tasks will be started based on the cron's system |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head></head> | |
<body> | |
<form class="form-horizontal" action="<?php echo url_for('module/action') ?>" method="post"> | |
<h2>Set of fields</h2> | |
<?php foreach(array($formObj['field1'], $formObj['field2']) as $sfFormFieldObj): ?> | |
<?php printAsBootstrapForm($formObj, $sfFormFieldObj); ?> | |
<?php endforeach; ?> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/****************************************************************************************** | |
These helpers are required for either: | |
link_to() | |
or | |
url_for() | |
******************************************************************************************/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
MONGO_HOST="prod.example.com" | |
TIMESTAMP=`date +%F-%H%M` | |
S3_BUCKET_NAME="bucketname" | |
S3_BUCKET_PATH="mongodb-backups" | |
# Create backup | |
$MONGODUMP_PATH --host $HOST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Helpers to render Bootstrap HTML for a symfony sfFormField object. | |
default input type is text | |
pass an array of field/widget names for each of the other different input types |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="datatables.js"></script> | |
</head> | |
<div class="well box"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Break down values of a table by distinct field with the number of times the value occurs | |
# (e.g. breakdown of distinct users and the number of successful logins for each user) | |
SELECT session_user, COUNT( session_user ) AS NumOccurrences | |
FROM sessions | |
GROUP BY session_user | |
ORDER BY NumOccurrences DESC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//see helper sec2hms https://gist.github.com/4435891 | |
$start = (float) array_sum(explode(' ', microtime())); | |
$end = (float) array_sum(explode(' ', microtime())); | |
$out = sprintf('Execution time: %s %s %s', sec2hms($end - $start), PHP_EOL, PHP_EOL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//credit: Jon Haworth at laughing-buddha.net (I added the $asArray param) | |
function sec2hms ($sec, $padHours = false, $asArray = false) | |
{ | |
// start with a blank string | |
$hms = ""; | |
// do the hours first: there are 3600 seconds in an hour, so if we divide |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('XML_PATH', 'foodata.xml'); | |
global $rows, $record, $fdata; | |
$rows = array(); | |
echo sprintf('Reading XML...'); |