Skip to content

Instantly share code, notes, and snippets.

var $$ = function(param) {
var node = $(param)[0];
var id = $.data(node);
$.cache[id] = $.cache[id] || {};
$.cache[id].node = node;
return $.cache[id];
};
// Now, instead of doing $("#foo").data("foo") and ("#foo").data("foo", "bar"),
// you can do $$("#foo").foo and $$("#foo").foo = bar.
@ecarter
ecarter / encode-html.coffee
Created November 5, 2011 14:55
encode html in coffeescript
# encode html
escape = (text) ->
replacements =
[/&/g, '&']
[/</g, '&lt;']
[/"/g, '&quot;']
[/'/g, '&#039;']
for r in replacements
text.replace r[0], r[1]
@yesmeck
yesmeck / README.md
Created August 14, 2012 15:12
Storing Hierarchical Data in a Database

Storing Hierarchical Data in a Database

@menzerath
menzerath / backup.php
Last active February 18, 2024 19:33
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* MIT-License - 2012-2018 Marvin Menzerath
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit', '1024M');

Description

Simple Dashing widget that tracks time since a certain event. Time Since Last waits for request to be made to your instance of Dashing and will then reset the time since the last occurrence of whatever event you would like to track. An example could be the time since the last exception for one of your applications, or the time since the last accident on the workfloor (better keep that widget green)!

The widget was made by @hannesfostie for use @openminds. If you end up using this widget, please send me a tweet! I'd love to hear about it.

Dependencies

This widget requires HTML5's localStorage in order to keep track of the last time the event occurred in order for it to work across restarts and refreshes.

@irazasyed
irazasyed / strpos_arr.php
Created July 12, 2013 17:21
PHP: Strpos Array, Find in array!
<?php
/* strpos that takes an array of values to match against a string note the stupid argument order (to match strpos) */
function strpos_arr($haystack, $needle) {
if(!is_array($needle)) $needle = array($needle);
foreach($needle as $what) {
if(($pos = strpos($haystack, $what))!==false) return $pos;
}
return false;
}
@willjohnson
willjohnson / README.md
Last active April 26, 2022 19:32
Server Status Widget for Dashing

Description

A Dashing widget that checks whether a server is responding to either an http or ping request. It displays either a check or alert depending on the response.

Usage

@wesee
wesee / README.md
Last active January 11, 2019 20:37
Weatheroutlook Dashing Widget
@jwalton
jwalton / OC Transpo for Dashing.md
Last active March 26, 2019 19:24
OC Transo widget for Dashing

Fetches times for the next buses at a given OC Transpo stop.

Add the following to your gemspec:

gem 'octranspo_fetch', '>= 0.0.4'

Screen Shot

Then configure the constants at the top of oc_transpo.rb.

@kylejohnson
kylejohnson / README.md
Last active December 6, 2018 21:22
pianobar widget for Dashing.

Preview

Pianobar Widget Preview

Description

Displays the currently playing song from pianobar, a CLI client for pandora.com

Dependencies

Your system ruby must have the following gems installed: net/http, json and uri.