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 / Fx.Morph.PerPropTransitions.js
Created December 21, 2009 04:25
Fx.Morph with per-property transitions
Fx.Morph.implement({
step: function(){
var time = $time();
if (time < this.time + this.options.duration){
var delta = {};
var d = (time - this.time) / this.options.duration;
var t = this.transition(d);
for (p in this.from){
var trans = this.transitions[p];
@cheeaun
cheeaun / Element.Style.CSS3.js
Created January 3, 2010 13:25
Extends MooTools' Element.Style to have the CSS3 juice.
(function(){
var styles = {
borderRadius: '@px @px @px @px/@px @px @px @px',
MozBorderRadius: '@px @px @px @px/@px @px @px @px',
WebkitBorderRadius: '@px @px @px @px/@px @px @px @px',
boxShadow: '@px @px @px rgb(@, @, @)',
MozBoxShadow: '@px @px @px rgb(@, @, @)',
WebkitBoxShadow: '@px @px @px rgb(@, @, @)',
textShadow: '@px @px @px rgb(@, @, @)'
@cheeaun
cheeaun / .bashrc
Created March 5, 2010 05:16
Show Git branch and uncommited changes in bash, via @iamclovin
# Git Prompt
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
export PS1='\u:\[\033[31;40m\]\w\[\033[0;33m\]$(parse_git_branch)\[\e[0m\]$ '
@cheeaun
cheeaun / imgs-delayed-lazyload.js
Created March 12, 2010 04:25
Lazy load images or delay them. Put this in the middle or end of <body> for 99.9% efficiency.
(function(){
var imgs = document.getElementsByTagName('img');
var l = imgs.length;
if (l<=0) return;
var srcs = [];
for (var i=0; i<l; i++){
var img = imgs[i];
srcs.push(img.src);
imgs[i].removeAttribute('src');
}
@cheeaun
cheeaun / say.html
Created March 19, 2010 04:24
Experimental page to test html5 <audio> tag with google translate tts technology.
<!DOCTYPE html>
<title>Say it to me!</title>
<link rel="stylesheet" href="http://cheeaun.github.com/cacss/ca.min.css">
<style>
body{
text-align: center;
}
input, button{
font-size: 2em;
width: 70%;
@cheeaun
cheeaun / plugin.say.js
Created March 20, 2010 15:18
Say plugin for Talkerapp, which implements Google TTS. Just type '$say something'
// https://cheeaun.talkerapp.com/plugins/193
var $style = $('<style>'
+ '.say-audio-control{'
+ 'text-decoration: none;'
+ 'background: #fff;'
+ 'color: #999;'
+ 'cursor: pointer;'
+ 'float: right;'
+ 'font-size: 10px;'
@cheeaun
cheeaun / ExpatLiving.js
Created March 23, 2010 14:31
Some (jsbeautified) code stolen from http://m.expatliving.sg/ written by Jacky Nguyen
(function (a) {
window.ExpatLiving = {};
window.ExpatLiving.SearchLayer = new Class({
Implements: [Options, Events],
Binds: ["onFormSend", "onFormComplete", "onFormFailure"],
options: {},
initialize: function (c, b) {
this.element = a(c);
this.setOptions(b || {});
this.element.style.webkitTransitionProperty = "0";
@cheeaun
cheeaun / one-line-variables-swap.js
Created July 5, 2010 02:26
JavaScript one-liner to swap two variables
// via http://twitter.com/izs/statuses/17744109574
var foo = 1;
var bar = 2;
foo = [bar, bar = foo][0];
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsSAAALEgHS3X78AAAEzElEQVRIia2Va4hUZRjHf8+5zTjjXnVd3dV0t7xQmkFK6oaaqKh4gcBAMrZPCqJpEoUQyOIHoaIUL2QESWZK4J3SvJUIautSSe6ii5p5WdfxNuvO7MyZOe/79mF2vdTs9qXny3Oeczj/3/k/73PeV+ghxi3dLWc2vm4A5q7cXCwiK4DBxpi6/Z8uudrTu10h/wGwS+1bhZbo5SDLgeLHT81WY6j7fv2yHkE9AmYuW79GhKVA8fCqSt6YPpbiogJ2HTnLqd8udHLMVgN1BzesyAvKC5i25LP1lpi3gcIR1ZUsmDGOkc8NJKsNyXSAJULsfju7jtZTf+5Cl6M6Y8y6w5vfi3cLmLL44522xWwgOqJ6IAtnTWBYVSXtvuGrXYfpV1JANNqLwqISygdUUOgJd+63sePAMa5cawFMHMN6g1l39PMP4k8BpixamwQi/fsUsXzhLEYNHcS1+1kSGc3dWAzlJ5g14QUAzt+MU9/cRmnfPlgYoo7h+o0b/HyqgestLQDx41+sKgFwugBaq0jtnIksmFnDrbYMTS0ptAFlhKSvGF5Z9ti2CLEHKbxIQCqjSWU1ll3GxNdmcOvWTY4e/eHRMDwCKKUo71dG082HaGOhsNAGAg3hSAH1l+5RVNibrNLsPnmZ0tJykumADl+T9DUdvqbDV2hdilKKfwG0UrSnMvQzoI1BG4MygtIaLxQmFC5ix4lrJFJZ+pb2w3E8kmlFMq1p78yJtCITaHQ+gNKKeMJH605hINCGQEFWGaLRCIO9MOmsIZXJfXWX+MOUIpFSBMqgTE4rr4OvD55jz+nbDKoop39ZKRVlvRHLoqCXg2PJI/EOX9Pua1ofZEn6mngyIJlWZDIa31dIXgdK4WJIpDI0/vWAxhaFuEksxwPLRsTCABiDyV3kcldtwGDheEImf4sCEB
@cheeaun
cheeaun / minimal-google-reader.userstyle.css
Created July 13, 2010 14:46
My own userstyle for minimalistic Google Reader UI
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document url-prefix("http://www.google.com/reader/view/"), url-prefix("https://www.google.com/reader/view/") {
#lhn-friends, #lhn-recommendations,#sub-tree-item-1-main,#sub-tree-item-480-main, #lhn-add-subscription-section, #search, #lhn-subscriptions-minimize,
#top-bar,#gb{
display: none !important;
}
}