- Project : Use JavaScript library / framework in gitweb
- Project Description : https://github.com/peff/git/wiki/SoC-2012-Ideas
- Code : https://github.com/jaseemabid/git/commits/gitweb
- DONE Port all existing functionality except ajaxy blame.
/* Supplant for templates and data filling */ | |
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; | |
}); |
document.body.contentEditable='true'; | |
document.designMode='on'; |
/* | |
* Curried code to add multiple numbers | |
Author : Jaseem Abid <jaseemabid@gmail.com> | |
* sum() expects 2 numbers are arguments | |
* If 2 args are provided, it returns sum as usual. | |
* If one arg is provided, it returns a | |
function which expects one more arg. JS closures can | |
'remember the first argument' and work accordingly. |
# Add the following code to your ~/.bashrc for awesome bash prompt. | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} |
/** PRODUCER - CONSUMER PROBLEM **/ | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <sys/ipc.h> | |
#include <sys/sem.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#define BUFSIZE 10 |
var connect = require('connect'), | |
WebSocketServer = require('websocket').server, | |
app = connect.createServer(); | |
app.use(connect.static(process.cwd())); | |
app.use(connect.router(function(app){ | |
app.get("/", function(req, resp) { | |
resp.write("Hola !"); | |
resp.end(); |
The panel clock in xfce suck! Its almost useless with is creepy color, which makes it hard to read and the stupid format with no space in between | |
So, it looked like old.png, customise a bit to make it look like new.png. | |
Use this text as the custom format to display the clock. | |
<span font_desc="Droid Sans Mono 10" color="#efefef" weight="normal">%a %d %b</span><span font_desc="Droid Sans Mono" color="#efefef" weight="bold"> [%I:%M %p]</span> | |
See the screenshots along here http://imgur.com/a/x2hma |
var Translator = function () { | |
"use strict"; | |
var lang, | |
private_map = {}, | |
cache = []; | |
this.addLang = function (lang, newLangDB) { | |
try { | |
private_map[lang] = newLangDB; |