Skip to content

Instantly share code, notes, and snippets.

View detj's full-sized avatar
🖥️
deep into work

Debjeet Biswas detj

🖥️
deep into work
View GitHub Profile
@detj
detj / dabblet.css
Created January 25, 2012 07:12
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
.box {
border: 1px solid;
width: 30%;
height: 200px;
margin: 0 auto;
box-shadow: inset 0px -18px 30px -7px #000;
@detj
detj / dabblet.css
Created February 15, 2012 18:57 — forked from chriscoyier/dabblet.css
Based on email I got from andrea ricci
/* Based on email I got from andrea ricci */
a[href^="mailto:"]:before { content: "\2709"; }
.phone:before { content: "\2706"; }
.important:before { content: "\27BD"; }
blockquote:before { content: "\275D"; }
blockquote:after { content: "\275E"; }
.alert:before { content: "\26A0"; }
:before, :after {
@detj
detj / Button.js
Created April 17, 2012 15:30
A simple Button for Impact.js
// A Button Entity for Impact.js
// Has 4 States:
// * hidden - Not shown
// * idle - just sitting there
// * active - someone is pushing on it
// * deactive - shown, but not usable
// And 3 Events
// * pressedDown - activated when pressed Down
// * pressed - constantly fires when pressing
@detj
detj / round-decimal.js
Last active October 5, 2015 22:17
Round to decimal places
function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}
@detj
detj / Bar.lua
Created July 2, 2012 19:37 — forked from juaxix/Bar.lua
Mágica Gems by juaxix for Codea - freesource - iPad
-- Bar class
-- LGPL Juan Belón Pérez
-- videojuegos.ser3d.es
--  2011
Bar = class()
function Bar:init()
    self.bgems = {}
    self.time  = 0
    for i=1,maxGemsRow do
@detj
detj / findGemBlocks.js
Created July 5, 2012 13:32
Finds blocks of same property recursively
// ig.game.* are global objects being used to store results
var findGemBlocks = function () {
var connectedGems = [],
finalGemBlocks = [],
getConnectedGems = function (gem) {
if (!_.include(connectedGems, gem)) {
connectedGems.push(gem);
if (_.include(_.flatten(finalGemBlocks), gem)) return false;
@detj
detj / erase.js
Created July 10, 2012 10:27
Erase an item from an array
Array.prototype.erase = function(item) {
for( var i = this.length; i--; ) {
if( this[i] === item ) {
this.splice(i, 1);
}
}
return this;
};
@detj
detj / maxStackSize.js
Created July 13, 2012 15:29
Find maximum call stack size
var maxStackSize = function(i){try{(function m(){++i&&m()}())}catch(e){return i}}(0);
@detj
detj / strings.js
Created September 21, 2012 16:10
Useful string functions
String.prototype.killWhiteSpace = function() {
return this.replace(/\s/g, '');
};
String.prototype.reduceWhiteSpace = function() {
return this.replace(/\s+/g, ' ');
};
@detj
detj / take-control-xhr.js
Created November 22, 2012 13:30
Trap external XHRs
function() {
var proxied = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function() {
console.log( arguments );
return proxied.apply(this, [].slice.call(arguments));
};
})();