Skip to content

Instantly share code, notes, and snippets.

@RandalK
RandalK / tdwtf.js
Created October 12, 2012 02:35
tdwtf comments bookmarklet
javascript:(function(){var b=document.getElementById('ArticleFull')||document.getElementsByClassName('ArticleBody')[0];b.innerHTML=b.innerHTML.replace(/<!\-\-/g,'<span style="color: green;">').replace(/\-\->/g,'</span>');})()
diff --git a/dirvish-expire.pl b/dirvish-expire.pl
index 1259d3d..35c8c61 100644
--- a/dirvish-expire.pl
+++ b/dirvish-expire.pl
@@ -166,14 +166,53 @@ for $expire (sort(imsort @expires))
$$Options{'no-run'} and next;
- system("rm -rf $$expire{path}/tree");
+ $exit = system("chmod u+rwX $$expire{path}/tree && find $$expire{path}/tree -type d -exec chmod u+rwX \\{\\} \\;");
@RandalK
RandalK / paste.html
Created July 8, 2012 07:46
Paste image uploader test
<!DOCTYPE html>
<html>
<head>
<title>Paste Here!</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js"> </script>
<!--<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"> </script>-->
<style>
.js-visible { display: none; }
img.resize-preview { width: 240px; }
ul { margin: 0; padding: 0; }
@RandalK
RandalK / gist:2894114
Created June 8, 2012 07:07
Entity Construction Kit - implement hook_field_extra_fields()
function eck_field_extra_fields() {
$extra_fields = array();
foreach (EntityType::loadAll() as $type) {
$entity_type =& $extra_fields[$type->name];
$entity_type = array();
foreach (Bundle::loadByEntityType($type) as $bundle) {
$fields =& $entity_type[$bundle->name];
$fields = array();
@RandalK
RandalK / gist:2505687
Created April 27, 2012 04:09 — forked from L-four/gist:2405585
g+ full sized images and google image search
;(function(ready, window){
// loading stuffs
var req = { paths: { jquery: "https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" }, };
// if missing requirejs hook define func
if (!window.require && !window.define) {
window.define = function(mod, list, callback) {
if (mod != 'jquery') return;
delete window.define;