Skip to content

Instantly share code, notes, and snippets.

@datfaf
datfaf / drochan
Created September 6, 2011 22:02 — forked from shokai/drochan
use dropbox as a chat
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
## dropboxの共有フォルダでチャットするツールです
## drochan -> 発言表示
## drochan ほむほむ -> 「ほむほむ」と発言
DIR = "#{ENV['HOME']}/Dropbox/drochan"
user = ENV['USER']
# user = "your-name"
@datfaf
datfaf / gist:1199098
Created September 6, 2011 21:55 — forked from brianstorti/gist:1107445
Add swap Ubuntu
sudo dd if=/dev/zero of=/swapfile bs=1M count=2048
sudo mkswap /swapfile
gksu gedit /etc/fstab
add to the end:
/swapfile none swap sw 0 0
reboot
@datfaf
datfaf / node-curry.js
Created September 5, 2011 10:13 — forked from fernandezpablo85/node-curry.js
Explanation of the curry function for node.js
function curriedReadFile(path) {
var _done, _error, _result;
var callback = function(error, result) {
_done = true,
_error = error,
_result = result;
};
fs.readFile(path, function(e, r) {
@datfaf
datfaf / supplant.js
Created September 4, 2011 01:18 — forked from couchoud/supplant.js
basic hs templating using String object and Regex
if (typeof String.prototype.supplant !== 'function') {
String.prototype.supplant = function (o) {
return this.replace(/{([^{}]*)}/g,
function (a, b) {
var r = o[b];
return typeof r === 'string' ? r : a;
});
};
}
@datfaf
datfaf / LICENSE.txt
Created September 4, 2011 00:35 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@datfaf
datfaf / gist:1191859
Created September 3, 2011 22:07 — forked from jeremyBanks/gist:9224
[2010-01] numbers written using entirely hexable characters
# Numbers that can be written in hex characters.
# 1 may only use as L or I exclusively in a given word.
# egrep -i "^([ABCDEFOLZSGT]+|[ABCDEFOIZSGT]+)$" /usr/share/dict/words
A
a
aa
aal
Ab
aba
abac

(a gist based on the old toolmantim article on setting up remote repos)

To collaborate in a distributed development process you’ll need to push code to remotely accessible repositories.

This is somewhat of a follow-up to the previous article setting up a new rails app with git.

For the impatient

Set up the new bare repo on the server:

@datfaf
datfaf / perlab.pl
Created August 17, 2011 17:43 — forked from FurryHead/perlab.pl
TinyCore Linux appbrowser written in perl, can be run from OSs other than TinyCore.
#!/usr/bin/perl -w
use warnings;
use strict;
use Term::ReadKey;
my $tce_mirror = "http://distro.ibiblio.org/pub/linux/distributions/tinycorelinux/";
my $tce_dir = `cat /opt/.tce_dir`;
$tce_dir = "./tce" if ($tce_dir eq "");
chomp $tce_dir;
@datfaf
datfaf / dynamic_select.js
Created July 27, 2011 16:19
js dynamic_select + ajax
function dynamicSelect(id1, id2) {
// Feature test to see if there is enough W3C DOM support
if (document.getElementById && document.getElementsByTagName) {
// Obtain references to both select boxes
var sel1 = document.getElementById(id1);
var sel2 = document.getElementById(id2);
// Clone the dynamic select box
var clone = sel2.cloneNode(true);
// Obtain references to all cloned options
var clonedOptions = clone.getElementsByTagName("option");
@datfaf
datfaf / a_templates-bmlet.html
Created July 18, 2011 13:18
small edits to templates/bmlet.html @ https://github.com/jpmens/scrumptious bookmarklet
-<a href="javascript:(function(){t=document.title;d=''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!d)d=prompt('No text selected; enter description',t);if(!d)return 0;tags=prompt('Enter space-separated list of tags','');if(!tags)return 0;uri='{{url}}';f=document.createElement('form');f.method='post';f.action=uri;i0=document.createElement('input');i0.type='text';i0.name='url';i0.value=location.href;i1=document.createElement('input');i1.type='text';i1.name='description';i1.value=d;i2=document.createElement('input');i2.type='text';i2.name='title';i2.value=t||'no title';i3=document.createElement('input');i3.type='text';i3.name='tags';i3.value=tags;f.appendChild(i0);f.appendChild(i1);f.appendChild(i2);f.appendChild(i3);b=document.createElement('body');b.appendChild(f);f.submit();})()">drag me to your bookmarks bar</a> to install the bookmarklet.</li>
12
+<a href="javascript:(function(){t=document.title;d=''+(window.getSel