Skip to content

Instantly share code, notes, and snippets.

$ git clone git://github.com/nikhilben/nikhilben.github.com
$ git clone git://github.com/nikhilben/DiggClient
$ git clone git://github.com/nikhilben/Chrome-Extensions
@0xnbk
0xnbk / copyToClipboard.js
Created November 29, 2010 04:51
Copy to clipboard JS
function copyToClipboard(meintext) {
if (window.clipboardData)
window.clipboardData.setData("Text", meintext);
else if (window.netscape) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
if (!clip)
return false;
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
if (!trans)
@0xnbk
0xnbk / .js
Created December 21, 2010 10:20
Javascript function to check for white spaces.
function hasWhiteSpace(s)
{
reWhiteSpace = new RegExp(/^\s+$/);
// Check for white space
if (reWhiteSpace.test(s)) {
alert("Please Check Your Fields For Spaces");
return false;
}
@0xnbk
0xnbk / .html
Created December 21, 2010 10:24
Submit on pressing enter in keyboard (javascript Function)
<html>
<script>
function addFolderKeyPress(e)
{
if (window.event) { e = window.event; }
if (e.keyCode == 13)
{
@0xnbk
0xnbk / duckduckgo.sh
Created January 2, 2011 16:56
DuckDuckGo Google Chrome extension fork
git clone git://github.com/nikhilben/DuckDuckGo
@0xnbk
0xnbk / opacity.css
Created January 11, 2011 06:03
Create Opacity for image through style
.change_opacity {
opacity: 0.5;
filter: alpha(opacity = 50);
}
@0xnbk
0xnbk / .css
Created January 28, 2011 09:04
Perfect Full Page Background Image [CSS3]
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
@0xnbk
0xnbk / favicon-interceptor.js
Created February 20, 2012 08:57 — forked from kentbrew/favicon-interceptor.js
How to short-circuit those annoying favicon requests in node.js
// early experiments with node had mysterious double requests
// turned out these were for the stoopid favicon
// here's how to short-circuit those requests
// and stop seeing 404 errors in your client console
var http = require('http');
http.createServer(function (q, r) {
// control for favicon