Skip to content

Instantly share code, notes, and snippets.


Mike Crittenden mikecrittenden

View GitHub Profile
View gist:844685
<form action="" method="post">
<input type="file" name="file" id="file-input" />
<input type="submit" value="Submit" id="submit-button" />
View dropdo.js
// Create a button element, because buttons can be styled however you like.
// Better to do this via JS than server side because we don't want it to show
// up for users with JS disabled, since it wouldn't work at all.
$('#upload-form').prepend('<button id="file-button">Upload a file</button>');
// Add a click handler to the newly created button element.
// Whenever the button is clicked, register a click on the file input, which
// will open the file browser thingy.
View gist:844696
<form action="" method="post" id="upload-form">
<input type="file" name="file" id="file-input" />
<input type="submit" value="Submit" id="submit-button" />
View gist:860452
if (user_is_logged_in() && !user_access('registered TGR user')) {
return FALSE;
return TRUE;
View receipt_and_kiosk_block.js
if (receipt_promo_value.length >= 12 && receipt_promo_value.length <= 18 ){
window.location = base_url + "/greenops/submit_code/receipt/" + receipt_promo_value;
} else {
// Redirect to the parameterized code handler pate
window.location = base_url + "/greenops/submit_code/promo/" + receipt_promo_value;
if (arg(0) == "user" && is_numeric(arg(1)) && arg(2) == "edit") {
// We are on the user's edit page, so include the css to hide the fields:
// Also check to see if this is an admin user
if (!array_key_exists(7, $user->roles)) {
// This is not an admin user, so hide the fields
drupal_add_css(drupal_get_path("module", "greenopolis_user_control_panel") . "/css/hide_edit_form_options.css");
// Also output some jQuery to change the HTML text of the password labels:
View greenopolis_front_page_2010Feb.module
switch ($delta){
case 0:
// Add the CSS stylesheet here, so it can get aggregated with other mods css
drupal_add_css(drupal_get_path('module', 'greenopolis_front_page_2010Feb') .'/css/receipt_and_kiosk_block.css');
drupal_add_js(drupal_get_path('module', 'greenopolis_front_page_2010Feb') .'/js/receipt_and_kiosk_block.js');
// This include file sets the $block_content variable
case 1:
View greenopolis_tgr.module
function greenopolis_tgr_invite($op, $args) {
if ($op == 'invite' && arg(0) == 'tgr') {
} elseif ($op == 'escalate' && arg(0) == 'tgr') {
$params = array(
'uid' => $args['inviter']->uid,
'points' => 50,
'operation' => 'TGR Refer Friend',
'description' => 'Friend Joined!',
'tid' => 103,
View greenopolis_donate.module.php
// give points to recipient
$params = array(
'uid' => $to->uid,
'points' => $points,
'event' => 'From: '. $user->name,
'description' => 'Points Donation',
'display' => FALSE,
'tid' => $tid,
View mkmf.log
have_header: checking for ruby.h... -------------------- no
"gcc -E -I. -I/usr/lib/ruby/1.8/i386-linux -I. -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -fno-strict-aliasing -fPIC conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <ruby.h>
/* end */