Skip to content

Instantly share code, notes, and snippets.

View KrofDrakula's full-sized avatar

Klemen Slavič KrofDrakula

View GitHub Profile
// Leaving foo declaration global, since I don't know
// whether you need it outside the scope of the closure.
var foo = function() {};
(function() {
// The closure has private variables if declared
// with "var ...".
// Adding event utility functions for event handlers
// by John Resig.
// is there any reason why I can't use this pattern to replace .live
// in favour for .delegate?
(function ($) {
$.root = $(document); // hat tip: Cory Hart
// keep safe
$.fn._live = $.fn.live;
$.fn._die = $.fn.die;
/* Requires jQuery */
var p = $("*");
setInterval(
function(){
var c = function() { return Math.floor(Math.random()*256); };
p.each(function(){
$(this).css("background","rgb(" + c() + "," + c() + "," + c() + ")");
});
}, 5
);
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<title>Overlap test</title>
</head>
<body>
<div class="page" style="background: yellow">
<h1>Test</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc auctor, augue vel commodo fermentum, urna dolor commodo lectus, vitae laoreet metus nunc sed turpis. Aliquam lorem dolor, faucibus ut convallis viverra, pulvinar eu nulla. Sed ac nulla eget est gravida lobortis vitae ac mauris. Vivamus fermentum lacus non nulla tristique eget ornare risus cursus. In at egestas risus. Sed vulputate fringilla dapibus. Aliquam erat volutpat. Sed rutrum lorem at dolor ullamcorper dignissim. In in metus leo. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Donec laoreet, nulla ac rhoncus hendrerit, est justo cursus nisi, eget lobortis odio mauris eu arcu. Proin sagittis, lacus et egestas ultricies, nisl lacus sodales mi, ac commodo magna augue ut arcu. Aenean ac auc
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Stereo page</title>
<style>
html, body, div { margin: 0; padding: 0 }
body { width: 1280px; margin: 0 auto; }
.stereo { background: url(cobblestone.jpg); padding: 40px; }
.header { margin: 40px; padding: 10px; background: rgba(0,0,0,0.5); color: white; }
<?xml version="1.0" encoding="utf-8" ?>
<cssmd:cssmd xmlns:cssmd="http://schemas.microsoft.com/Visual-Studio-Intellisense/css" version="VS8" description="CSS3 validation data">
<cssmd:property-set>
<!-- Based on the original css21.xml from Visual Studio 2010 -->
<!-- Font Properties -->
<cssmd:property-def _locID="color" _locAttrData="description,syntax" type="color"
description="Color of an element's text"
syntax="#RRGGBB | Named Color | rgb(R, G, B) | rgba(R, G, B, A) | inherit"
enum="inherit Aqua Black Blue Fuchsia Gray Green Lime Maroon Navy Olive Orange Purple Red Silver Teal White Yellow ActiveBorder ActiveCaption AppWorkspace Background ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLighShadow ThreeDShadow Window WindowFrame WindowText"/>
@KrofDrakula
KrofDrakula / jquery-dep-loader.js
Created January 9, 2011 15:21
A quick-n-dirty jQuery loader for plugins
(function($) {
var Initialize = function($) {
alert("Loaded jQuery v." + $.fn.jquery);
// your plugin code here
};
// loader function for jQuery in case jQuery isn't found on the page
var LoadDependencies = function() {
@KrofDrakula
KrofDrakula / faster-twitter.js
Created January 22, 2011 18:16
Add this bookmarklet and use it on Twitter if scrolling seems sluggish
javascript:void(jQuery(window).unbind('scroll'))
// jQuery patch for HTML5 elements using innerShiv by https://github.com/andy-clusta
// http://jdbartlett.github.com/innershiv | WTFPL License
window.innerShiv = (function () {
var div, frag,
inaTable = /^<(tbody|tr|td|col|colgroup|thead|tfoot)/i,
remptyTag = /(<([\w:]+)[^>]*?)\/>/g,
rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,
fcloseTag = function (all, front, tag) {
return rselfClosing.test(tag) ? all : front + '></' + tag + '>';
<?php
function convertDir($directory, $target, $from, $to) {
$dir = opendir($directory);
while(false !== ($file = readdir($dir))) {
if(is_dir($file)) {
convertDir($directory . "/" + $file, $target . "/" . $file, $from, $to);
} else {
file_put_contents($target . "/" . $file, iconv($from, $to, file_get_contents($file)));
echo "Converted $file\n";