Skip to content

Instantly share code, notes, and snippets.

@slikts
slikts / confere.js
Created April 13, 2011 10:45
Bookmarklet to display and synchronously scroll multiple subdomains
javascript:void((function($)
{
var domain = 'example.com';
var subdomains = ['www', 'dev'];
if (!jQuery || location.hostname.indexOf(domain) < 0) {
return false;
}
var row_height = 100 / subdomains.length;
var $rows = $([]);
@slikts
slikts / load_jq.js
Created April 13, 2011 11:28
Load jQuery from Google CDN
/*
* @param object callback
* @param object document context
* /
function load_jq(callback, document)
{
if (window.jQuery) {
if (callback) {
callback(jQuery);
}
@slikts
slikts / prototype_login.js
Created April 13, 2011 11:40
Login bookmarklet for a Prototype site
javascript:(function() {
var usr = '000000', pwd = '000000', cde = '000000';
var card;
if (card = $('cardPwd')) {
card.value = cde;
} else {
$('userId').value = usr;
$('fixedPwd').value = pwd;
}
$('loginForm').submit();
@slikts
slikts / load_jq.js
Created April 13, 2011 11:50
Bookmarklet for loading jQuery from Google CDN
javascript:(function() {
var s = document.createElement('script');
s.onload = function() {
jQuery.noConflict();
if (window.console && window.console.log) { window.console.log('jQuery', jQuery.fn.jquery); }
};
s.setAttribute('src', location.protocol + '//ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js');
document.getElementsByTagName('head')[0].appendChild(s);
})();
@slikts
slikts / gist:1159341
Created August 20, 2011 16:56
mangareader.net user CSS
#wrapper_header,
#adtop,
#topchapter,
#bottomchapter,
#adfooter,
#zoomer,
#wrapper_footer,
.zoomimg {
display: none;
}
@slikts
slikts / gist:1164980
Created August 23, 2011 12:23
CSS test bookmarklet
javascript:(function() { var x = document.createElement('style'); document.getElementsByTagName('head')[0].appendChild(x); var y = document.createElement('textarea'); y.setAttribute('style', 'position: fixed; right: 0; top: 0; z-index: 99999;'); y.addEventListener('keydown', function() { x.innerHTML = this.value; }); document.body.appendChild(y); })();
@slikts
slikts / MethodEvents.js
Created March 7, 2012 10:24
Ext JS Observable Method Events
(function() {
// Private
function addMethodEvent(options) {
var method = this[options.method];
var event = (options.prefix ? options.prefix + '_' : '') + options.method;
function wrap() {
this.fireEvent(event + '_start', this, arguments);
this.fireEvent(event + '_end', this, arguments,
method.apply(this, arguments));
<!doctype html>
<html>
<head>
<title>Column example</title>
<style type="text/css">
.col-a {
float: left;
width: 100%;
margin-left: -200px;
}
@slikts
slikts / togglepause.ahk
Last active December 23, 2015 16:39
Toggle play/pause with window selection
; Bind Ctrl+Win+Space to select the video window for toggling.
; If it's a browser window and the video player is Flash (it most commonly is),
; then the player itself needs to be focused by clicking on the player.
; If the player is not focused the page will likely just get
; scrolled down without play/pause being toggled.
; I've made a Chrome extension to focus the YouTube player automatically: http://bit.ly/1gPHwI8
^#space:: WinGet, winid ,, A
; Bind Win+Space to send the Space keystroke to the selected window.
; This will only work if the player supports a Space hotkey for toggling play/pause.
@slikts
slikts / clone.js
Last active August 29, 2015 13:57
Object cloning using property descriptors
function clone(obj, deep) {
if (!(obj instanceof Object)) {
return obj;
}
var descriptors = {};
Object.getOwnPropertyNames(obj).forEach(function(name) {
var prop = Object.getOwnPropertyDescriptor(obj, name);