Skip to content

Instantly share code, notes, and snippets.

View typeofweb's full-sized avatar
🛒
https://yournextstore.com

Michał Miszczyszyn typeofweb

🛒
https://yournextstore.com
View GitHub Profile
@typeofweb
typeofweb / tester.bat
Created May 6, 2012 22:38
Windows console tester
@echo off
set TEST=%1
set NR=%2
set INDIR=in\
set OUTDIR=out\
set MYOUTDIR=results\
If not exist %MYOUTDIR% (mkdir %MYOUTDIR%)
@typeofweb
typeofweb / main.html
Created May 17, 2012 23:14
Konwerter Banana
<!DOCTYPE html>
<meta charset="utf-8">
<title>:)</title>
<script>
var commentify = function() {
var txt = document.createElement('textarea'),
btn = document.createElement('button'),
content = document.createElement('div'),
@typeofweb
typeofweb / washingMachine.js
Created May 31, 2012 13:20
Washing Machine Asynchronous Programming
(function(){
let WashingMachine = createWashingMachineFromElement(this);
WashingMachine.addEventListener("ready", function(){
WashingMachine.SetTemp(60, 'celcius', function(){
WashingMachine.SetMode(MODE_NORMAL, function(){
WashingMachine.Engage(function(){
WashingMachine.StartWashing();
});
});
});
@typeofweb
typeofweb / gist:3121875
Created July 16, 2012 09:54
Font smoothing
.font-smoothing (@val:antialiased) {
-webkit-font-smoothing: @val;
-moz-font-smoothing: @val;
font-smoothing: @val;
}
var routeModule = function (module) {
var routes = {};
routes[module + '/*url'] = 'handleUrl';
routes[module] = 'handleUrl';
var ModuleRouter = Backbone.Router.extend({
routes: routes,
handleUrl: function (url) {
require(['modules/' + module + '/' + module], function (myModule) {
url = url || '';
@typeofweb
typeofweb / webNotification.js
Last active October 7, 2015 21:08
Web Notifications
var showNotification = function (data) {
if (window.webkitNotifications) {
if (!webkitNotifications.checkPermission()) {
var notif = webkitNotifications.createNotification(data.icon, data.title, data.body);
notif.show();
} else {
webkitNotifications.requestPermission(function () {
showNotification(data);
});
}
@typeofweb
typeofweb / console_hack.js
Created November 28, 2012 21:28
Remove console.logs from production
for (var i in window.console) {
if (typeof window.console[i] === "function") {
window.console[i] = function(){return!0}
}
}
@typeofweb
typeofweb / gist:4452051
Last active December 10, 2015 15:08
Adds `cls` command which is no more than double clear.
echo "clear && clear" > /usr/local/bin/cls && chmod +x /usr/local/bin/cls
// Internal recursive comparison function for `isEqual`.
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;