Usage:
- open any website using jQuery.
- in the URL type
javascript:$('*').each(function() { $(this).css({background: "#"+((1<<24)*Math.random()|0).toString(16)});});
Yes! it's ugly!
| #-*- coding: utf8 -*- | |
| import random | |
| import logging | |
| from cmdbot.core import Bot | |
| from cmdbot.decorators import no_verb, regex | |
| from cmdbot.core import logger | |
| from cmdbot.configs import ArgumentConfiguration | |
| logger.setLevel(logging.DEBUG) | |
| /** | |
| * Casper script to restart Alwaysdata processes. | |
| * | |
| * Usage: | |
| * $ casperjs kill.js [email protected] mysecretpassword | |
| */ | |
| var casper = require('casper').create(); | |
| casper.start("https://admin.alwaysdata.com/login/"); |
| $ git init Stardrifter-gh-pages | |
| $ cd Stardrifter-gh-pages | |
| $ git remote add origin [email protected]:brunobord/stardrifter.git | |
| $ git fetch [email protected]:brunobord/stardrifter.git gh-pages:refs/remotes/origin/gh-pages | |
| $ git pull | |
| $ git checkout gh-pages |
| *.pyc | |
| .pytest_cache/ | |
| .coverage | |
| .tox/ |
Usage:
javascript:$('*').each(function() { $(this).css({background: "#"+((1<<24)*Math.random()|0).toString(16)});});
Yes! it's ugly!
| var my_true = Boolean("true"); // == true | |
| var my_false = Boolean("false"); // == true // WTF? | |
| var my_question = Boolean("what's the bloody point of the Boolean() function?"); // == true // WAT | |
| //Solution: | |
| var ok = JSON.parse("true"); // == true | |
| var ko = JSON.parse("false"); // == false | |
| Object.getPrototypeOf(localStorage).dumps = function() { | |
| return JSON.stringify(this); | |
| }; | |
| Object.getPrototypeOf(localStorage).loads = function(str, clear) { | |
| if (clear == true) | |
| this.clear(); | |
| var doc = JSON.parse(str); | |
| for (var i = 0; i < Object.keys(doc).length; i++) { | |
| key = Object.keys(doc)[i]; | |
| this.setItem(key, doc[key]); |
| // -------- Database section | |
| // current version | |
| var __version__ = '1.0.0'; | |
| var __versions__ = { | |
| '1.0.1': migrate_1_0_1, | |
| '1.0.2': migrate_1_0_2, | |
| '1.0.3': migrate_1_0_3, | |
| } | |
| function migrate_1_0_1() { | |
| console.log('going into migrate_1_0_1'); |
| # If I had one PEP8 rule to wipe off, that would be the "argument indentation" thing | |
| # isn't this PEP8-compliant code a bit against the "Flat is better than Nested" zen of Python? | |
| my_superb_variable = MyBloodyClass(arg1='here is an argument', | |
| label=_(u'What a beautiful label'), | |
| argument2='sorry', | |
| argument3=False) | |
| # And in this case, I'm lucky. I'm not *inside* a class method or worse: inside a loop or a condition inside a class method. | |
| # I really hate this indentation. |