Skip to content

Instantly share code, notes, and snippets.

View pifantastic's full-sized avatar

Aaron Forsander pifantastic

  • Stripe
  • Austin, TX
View GitHub Profile
@pifantastic
pifantastic / thing.js
Last active December 10, 2015 00:59 — forked from cowboy/thing.js
function Thing(prop) {
this.prop = prop;
}
Thing.prototype.toString = function() {
return "My prop is: " + this.prop;
};
module.exports = function (opts) {
return new Thing(opts);
@resetInputsForForm: (form_html, taskNumber, taskType) ->
form = $(form_html)
form.find('input').each (index, element) ->
taskNamePrefix = "#{taskType}_task"
currentName = $(element).attr('name')
multipleParamNamePrefix = "inputs_for_task['#{taskNumber}']"
newName = currentName.replace(taskNamePrefix, multipleParamNamePrefix)
$(element).attr('name', newName)
form
$('fieldset').each(function(i){
if (i == 0){
someFunction();
}
});
$(".add_comment_link").click(function() {
$(this).next(".add_comment").slideToggle();
});
<?php
/**
* Escape special characters.
*
* See http://en.wikipedia.org/wiki/XML#Escaping
*/
function ec_dreammail_escape_xml($string) {
$search = array('<', '>', '&', '"', "'");
$replace = array('&lt;', '&gt;', '&amp;', '&quot;', '&apos;');
<?php
/**
* Implementation of hook_block().
*/
function ec_channel_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
return array(
'products_and_events' => array(
$('#model-versions ul li a').click(function() {
$('section.left article').animate({opacity: 0 }, 1000).load(this.href + " section.left article");
});
backend default {
.host = "127.0.0.1";
.port = "8080";
// No more than 30% of requests should take more than 20s.
.probe = {
.url = "/";
.timeout = 30s;
.window = 10;
.threshold = 3;