Skip to content

Instantly share code, notes, and snippets.

View karolk's full-sized avatar
💭
cooking on gas

Karol K karolk

💭
cooking on gas
View GitHub Profile
@karolk
karolk / ie6-throttle.js
Created July 4, 2012 13:32
Detect that the user is running IE6 and sets the screen update rate at 1 refresh per 10 seconds. This makes the website look very slow. The setting will continue to work in a browser window even if the user visits a different website as IE6 sets this for
navigator.userAgent.toLowerCase().indexOf("msie 6.")!=-1&&(screen.updateInterval=10000);
@karolk
karolk / wordpress vulnerability tokens
Created May 1, 2012 14:27
tokens to grep for in wordpress code to check if it was hacked into
eval(
auth_pass
_0x4
WordPress\.Org
5db4c956bb56f6f050412fecd239344f
hgerwhu45
maridora
strrev
base64_decode
decrypt
@karolk
karolk / isEmptyNullUndef.js
Created April 25, 2012 11:56
check if a value is null, undefined empty string or an empty array
//returns true if [], '', null, undefined
//returns false if 0, false, {}, NaN
function isEmptyNullUndef(value) {
return [value] == '';
}
@karolk
karolk / temple-template.html
Created April 2, 2012 21:38
temple.js templating example
<h1 data-templ="header"></h1>
<ul data-templ="items">
<li>
<strong data-templ="strong name"></strong>
<a href="#" data-templ="url name"></a>
</li>
</ul>
<p data-templ="empty">The list is empty.</p>
@karolk
karolk / moustache-template.html
Created April 2, 2012 21:33
moustache.js template example
<h1>{{header}}</h1>
{{#bug}}
{{/bug}}
{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
@karolk
karolk / README.md
Created March 26, 2012 13:53
Templating plugin for jQuery working with HTML tree. No <% fancy %> {% brackets %}
@karolk
karolk / jsrpc.js
Created March 9, 2012 19:52
rpc in JavaScript
/*
Call certain JS functions in a controlled way by passing the name in the URL.
This can be likened to XSS but done in a controlled way
#Possible use case
Let's assume there is a social networking site having a feature 'invite me for lunch'.
Unfortunately the feature is not very well visible in the GUI. Assuming there is a JS
function inviteForLunch(ISODate) defined on the page people could create links on their
@karolk
karolk / LICENSE.txt
Created January 3, 2012 18:29 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Karol Kowalski <http://github.com/karolk>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@karolk
karolk / ObjectCreate.js
Created December 2, 2011 16:13
Object.create wrapper with shorter property descriptor syntax and graceful handling for browsers not supporting it
function ObjectCreate(proto, properties) {
var propDesc = {}, p, pd, pdStr, ES5 = !!(Object.create && Object.defineProperties);
if (!ES5) {
var F = function() {};
F.prototype = proto;
var o = new F();
}
for (p in properties) {
pd = properties[p], pdStr = pd.pd.toLowerCase();
if (ES5) {
@karolk
karolk / beep_number.py
Created October 25, 2011 19:26
play a little tune based on any number (Windows)
import time
import winsound #only works on windows, any similar APIs on Mac/Linux?
def beep_number(number, length=200):
#sounds frequencies in hertz, starting from middle C and going up to high E
sounds = [261, 294, 330, 350, 392, 440, 494, 523, 587, 659]
i=0
while i<len(number):
winsound.Beep(sounds[int(number[i])],length)