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 / 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 / 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 / break_link.css
Created November 18, 2013 20:52
Break up long links
@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 / 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 / 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 / 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 / os_cleanup.sh
Created July 22, 2014 19:57
Run on Debian/Ubuntu/Knoppix to strip down to barebones install.
apt-get purge $(dpkg-query -Wf '${Package;-40}${Essential}${Priority}\n'|awk '$2 ~ /nooptional|noextra/ {print $1}'|grep -v -E 'anacron|busybox|initramfs-tools|insserv|klibc-utils|libklibc|libsemanage-common|libsemanage1|libustr-1.0-1|libuuid-perl|linux-base|linux-image')
@melz
melz / keybase.md
Created June 25, 2014 14:15
Keybase

Keybase proof

I hereby claim:

  • I am melz on github.
  • I am melz (https://keybase.io/melz) on keybase.
  • I have a public key whose fingerprint is 46B5 E847 8058 C0E0 159C AE4C 4EA0 6332 D24A 2FE8

To claim this, I am signing this object: