Skip to content

Instantly share code, notes, and snippets.

View melz's full-sized avatar

Melissa P. melz

  • Ontario, Canada
View GitHub Profile
@melz
melz / sf14_get_raw_value
Created June 18, 2013 17:11
Obtain the raw value from an sfOutputEscaperArrayDecorator object
<?php
// 1) Escaping on; View template
$manufacturers = $sf_user->getAttribute('manufacturer_ids', array(), 'mdUser');
$user_manufacturers->getRawValue(); // returns an array()
// for variables in view template
echo $sf_data->getRaw('variable_name');
// disable escaping from class method output
@melz
melz / update_repos.sh
Created June 18, 2013 17:16
Update Debian Wheezy repos
# add to /etc/apt/sources.list
deb http://ftp.ca.debian.org/debian stable main contrib
deb http://ftp.debian.org/debian/ wheezy-updates main contrib
deb http://security.debian.org/ wheezy/updates main contrib
@melz
melz / install_apm.sh
Created June 18, 2013 17:21
Installs Apache2 with PHP (with common utils) and MySQL support
apt-get install libapache2-mod-php5 php5-mysql php5-gd php5-mcrypt php5-curl php-apc
a2enmod rewrite
a2enmod ssl
@melz
melz / jquery_save_responses.js
Created June 18, 2013 17:41
jQuery: Save responses when the user has finished typing.
// For each input element, we will assign them a timer to avoid sending too many changes to the server at the same time.
var timeout = [];
$('.input-element').each(function() {
timeout[this.id] = null;
})
$('.input-textarea').on('input', function() {
clearTimeout(timeout[this.id]);
var response = $(this).val();
@melz
melz / check_disk_age.sh
Created November 15, 2013 21:26
Check for the age of the HD
smartctl -a /dev/sda | grep Power
@melz
melz / app.php
Created November 15, 2013 22:03 — forked from lucasmezencio/app.php
Swiftmailer + Twig + Silex app.
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$app = require __DIR__.'/bootstrap.php';
$app->match('/contact/', function(Request $request) use ($app) {
if ('POST' == $request->getMethod()) {
$data = array(
@melz
melz / break_link.css
Created November 18, 2013 20:52
Break up long links
@melz
melz / reset.css
Created December 8, 2013 12:59
Make all elements use padding and border as part of the block.
*,
*:after,
*:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.clearfix:after {
content: "";
display: table;
@melz
melz / recursively_chmod_directories.sh
Created March 5, 2014 17:17
Command to recursively change directory permissions to 755
find . -type d -exec chmod 755 {} +
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {