Skip to content

Instantly share code, notes, and snippets.

View cheeaun's full-sized avatar
🐘
Follow me on https://mastodon.social/@cheeaun

Chee Aun cheeaun

🐘
Follow me on https://mastodon.social/@cheeaun
View GitHub Profile
@cheeaun
cheeaun / scroll-text-url.js
Created July 22, 2010 10:29
Scrolling text in the URL bar (in Chrome and Safari)
// http://news.ycombinator.com/item?id=1536364
// http://twitter.com/simonw/statuses/19238183056
javascript:var dashes = ""; var num = 20; while(--num) dashes += "-"; setInterval(function() { window.history.replaceState("", "", dashes.slice(0, num % 20) + "foo" + dashes.slice(num % 20)); num++;}, 500)
@cheeaun
cheeaun / fb-friend-locationer.html
Created August 29, 2010 03:04
Get your Facebook friends' current location
<!DOCTYPE html>
<title>FB Friend Locationer</title>
<style>
* {font-family: sans-serif;}
table th, table td{border: 1px solid #ccc; padding: 0 1em;}
</style>
<table id="loc">
<thead>
<tr>
<th>Name</th><th>Current location</th>
@cheeaun
cheeaun / ab.js
Created September 13, 2010 02:08
Javascript variable to return 'A' but 'B' when converted to string.
// Answer for http://twitter.com/DmitryBaranovsk/status/24339436227
// Question: #jsquiz var a = …; Define a, so those alerts will work like that: alert(a + ""); // alerts "A"; alert(a); // alerts "B";
var a={toString:function(){return 'B'},valueOf:function(){return 'A'}};
@cheeaun
cheeaun / firefox-win7-fix.css
Created September 18, 2010 13:48
My own fixes to make Firefox looks slightly better on my Windows 7, applied with Stylish extension
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* Bigger type for Location and Search Bar */
#nav-bar[iconsize=large] #urlbar,
#nav-bar[iconsize=large] #searchbar .searchbar-textbox{
-moz-box-shadow: 0 0 transparent !important;
}
#nav-bar[iconsize=large] #urlbar .textbox-input-box,
#nav-bar[iconsize=large] #searchbar .textbox-input-box{
@cheeaun
cheeaun / neatbookmarks.largerfontsize.css
Created September 28, 2010 06:30
Larger font size CSS for Neat Bookmarks.
body, #search input, #edit-dialog input {font-size: 14px;}
.dialog-text {font-size: 15px;}
<!DOCTYPE html>
<style>
body{
width: 400px;
}
p, div{
-webkit-transition-duration: 3s;
}
p:hover{
background-color: yellow;
@cheeaun
cheeaun / facebook-tinymce.js
Created October 7, 2010 02:44
Facebook's TinyMCE code
function MceEditor() {}
MceEditor.prototype = {
init: function (b, c) {
this.canvasId = b.id;
this.settings = c;
var a = c.plugins;
if (a && a.search('AtD') !== -1) this.settings.atd_rpc_id = $('post_form_id').value;
if (this.is_visible || !this.settings.delay_initialization) this.startEditor();
},
startEditor: function () {
function floatImages()
{
// adapted from http://www.dithered.com/javascript/browser_detect/
//**************************************************************//
// sniff user agent
var userAgent = navigator.userAgent.toLowerCase();
// if Mozilla 1.4 then quit
if ((userAgent.indexOf('gecko') != -1) && (userAgent.indexOf('gecko/') + 14 == userAgent.length) && (parseFloat(userAgent.substring(userAgent.indexOf('rv:') + 3)) == '1.4')) return;
@cheeaun
cheeaun / XD.js
Created November 4, 2010 08:39
Backwards compatible window.postMessage()
// from http://www.onlineaspect.com/2010/01/15/backwards-compatible-postmessage/
var XD = function(){
var interval_id,
last_hash,
cache_bust = 1,
attached_callback,
window = this;
return {
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
.urlbar-origin-label{
display: none !important;
}
.urlbar-over-link-box{
background-image: none !important;
color: -moz-fieldtext !important;
padding-left: 4px !important;