Skip to content

Instantly share code, notes, and snippets.

View alicraigmile's full-sized avatar

Ali Craigmile alicraigmile

View GitHub Profile
@michaelsauter
michaelsauter / BasePresenter.php
Last active December 15, 2024 21:55
Simple presenter pattern for Symfony2/Twig. Really useful to get some view logic out of the models and views into its own separate space.
<?php
namespace Acme\DemoBundle\Presenter;
class BasePresenter
{
protected $subject;
public function __construct($subject)
{
@ryangadams
ryangadams / air-quotes.js
Created October 2, 2012 23:34
A js bookmarklet to extract the words on news websites that are 'quoted'.
var myPanel = document.querySelector("#my-quote-panel");
if (myPanel == null) {
myPanel = document.createElement("div");
myPanel.setAttribute("id", "my-quote-panel");
}
myPanel.innerHTML = "<h1>Air Quotes</h1>";
myPanel.setAttribute("style", 'position:relative;padding:10px;border-bottom:1px solid #008800;background:#fff;color:#333;z-index:1000;font-size:16px;clear:both;overflow:hidden;');
document.body.insertBefore(myPanel, document.body.firstChild);
var fullContent = "";
var content = document.querySelectorAll("body > div");
@mrenouf
mrenouf / reverse-tether.sh
Created August 11, 2012 23:01
USB reverse tethering script (only tested on Ubuntu 12.04 with Galaxy Nexus)
#!/bin/bash
ADB="/home/mrenouf/bin/adb"
# We need root on the host to mess with networking
if [[ $(whoami) != "root" ]]; then
echo "You must be root to run this script!"
exit 1
fi;