Skip to content

Instantly share code, notes, and snippets.

<?php
$raw_email = <<<TEST
Tizag.comi $100
Webmaster Tutorials
Unlock your potential!
TEST;
echo $raw_email;
exec("EMAIL=" . escapeshellarg($raw_email) . "; echo \"\$EMAIL\";", $result);
print_r($result);
#!/bin/sh
#
# This command expects to be run within the Open Atrium profile directory. To
# generate a full distribution you it must be a CVS checkout.
#
# To use this command you must have `drush make`, `cvs` and `git` installed.
#
if [ -f openatrium.make ]; then
echo "\nThis command can be used to run openatrium.make in place, or to generate"
#!/bin/sh
#
# Build a complete tar.gz archive of Drupal + Open Atrium
#
# This command expects to be run withing a CVS checkout of the Open Atrium
# project. It can only be run without arguments. It will generate a output file
# of the format openatrium-TAG.tar.gz in the current directory.
#
MAKE=$(cat <<EOF
@KyleAMathews
KyleAMathews / gist:665203
Created November 6, 2010 04:41
Create etherpad with this script
<?php
$padId = 'testingmoreplease';
$domain = "http://piratepad.net";
$ch = curl_init();
# for debugging
curl_setopt($ch, CURLOPT_HEADER, true);
function etherpad_field_settings($op, $field) {
switch ($op) {
// Code removed.
case 'database columns':
return array(
'etherpad_url' => array('type' => 'varchar', 'length' => 1024, 'not null' => FALSE,),
'etherpad_text' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
'attributes' => array('type' => 'text', 'size' => 'medium', 'not null' => FALSE),// Then add auto-generate etherpad function.
);
}
/**
* Implementation of hook_widget().
*/
function etherpad_widget(&$form, &$form_state, $field, $items, $delta = 0) {
$element['etherpad_url'] = array(
'#type' => 'value',
'#value' => (isset($items[$delta]['etherpad_url']) && !empty($form['nid']['#value'])) ? $items[$delta]['etherpad_url'] : $field['etherpad_url'] . etherpad_generate_padid($field['etherpad_url']),
);
$element['etherpad_text'] = array(
'#type' => 'value',
@KyleAMathews
KyleAMathews / onchange.sh
Created May 12, 2011 01:00
Run an arbitrary command on any changes to an arbitrary file
#!/bin/bash
# Usage: onchange.sh COMMAND FILE
# On Ubuntu/Debian, you'll need to install the inotify-tools package.
COMMAND=$1
FILE=$2
# Run once initially.
$command $file
@KyleAMathews
KyleAMathews / gist:1345969
Created November 7, 2011 19:54
My five line node.js/coffeescript/mongodb RESTful API
app.get '/groups', (req, res) ->
Group = mongoose.model 'group'
Group.find (err, groups) ->
if err then console.error err
res.json groups
@KyleAMathews
KyleAMathews / makeExpandingArea.coffee
Created November 29, 2011 22:28
jQuery plugin for making textareas auto-exapand. Based on article at http://www.alistapart.com/articles/expanding-text-areas-made-elegant/
$ = jQuery
$.fn.makeExpandingArea = () ->
@.each ->
container = $(@)
area = container.find('textarea')
span = container.find('span')
area.on 'input', ->
span.text(area.val())
@KyleAMathews
KyleAMathews / setup-statsd.sh
Created April 28, 2012 00:57 — forked from collegeman/setup-statsd.sh
Turn an Ubuntu 12.04 Amazon EC2 Micro instance into a StatsD/Bucky/Graphite server
# install git
sudo apt-get install g++ curl libssl-dev apache2-utils make
sudo apt-get install git-core
# download the Node source, compile and install it
cd /opt
git clone https://github.com/joyent/node.git
cd node
git checkout v0.6
./configure