Skip to content

Instantly share code, notes, and snippets.

@jney
jney / text.js
Created November 11, 2009 12:29
window.onload = function () {
var r = Raphael("holder", 800, 200),
str = r.print(180, 100, "86.68.254.163", r.getFont("Bangalore"), 50);
str.attr({fill: "#f00", opacity:.5, scale: ".05,.05" });
(function(pos){
var args = arguments;
if(pos>=str.length) pos = 0;
str[pos].animate({opacity:1}, 200, function(){
this.animate({opacity:.5}, 200); // it is not executed why ?
$.fn.fixImgSrc = function(img){
$(this).each(function(){
var $that = $(this);
$(this).error(function() {
$that.attr("src",img);
});
});
};
var inputs = parent.frames[1].document.getElementsByTagName("input");
for (var i in inputs) {
if (inputs[i].type && inputs[i].type.toLowerCase() == 'checkbox') {
inputs[i].checked="checked";
}
}
parent.frames[1].SetCmd("delete");
<!--[if IE]>
<object classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13" data="some.html">
<![endif]-->
<!--[if !IE]> <-->
<object type="text/html" data="some.html">
<!--> <![endif]-->
<p>backup content</p>
</object>
webkit2png -o "$(date +"%Y%m%d%H%M")" -F "http://www.lefigaro.fr/"
/***
* How to use it in your html page :
* copy the code and paste it in your page and update param passed to
* Figaro.redirectUrl to desired page. So, Figaro.redirectUrl will
* return new calculated URL.
*
* - Calculated link to pass through
* <a href="#" onclick="window.location.replace(Figaro.redirect)">
* Pass this ad
* </a>
// naissances|anniversaires|autres-evenements|conferences|deces|mariages
var
pathname = location.pathname,
siteId = "Carnet_du_jour",
x2 = 14;
// url = http://carnetdujour.lefigaro.fr/
if (pathname == "/") {
atiTag({
chapters: [siteId,"accueil_carnet_du_jour","accueil_carnet_du_jour","accueil_carnet_du_jour"],
/*
Add a bookmark to this
javascript:(function(b){for(var c=0,a=b.length;c<a;c++){var d=b[c];if(d.rel==="stylesheet"||d.type==="text/css"){var e=d.href.split("?",2);d.href=e[0]+"?"+((e.length===2)?e[1]+"&":"")+(new Date().getTime())}}})(document.getElementsByTagName("link"));
*/
;(function (links) {
for (var i = 0, len = links.length; i < len; i++) {
var link = links[i];
if (link.rel === 'stylesheet' || link.type === 'text/css') {
@jney
jney / wait_time.sh
Created November 25, 2010 11:21
wait_tries.sh
#!/bin/bash
LOCK_FILE="pgr.lock"
MAX_TRIES=5
if [[ -f $LOCK_FILE ]]; then
TRIES=$((`cat $LOCK_FILE` + 1))
echo $TRIES > $LOCK_FILE
if [[ $TRIES < $MAX_TRIES ]]; then
# compare 2 files, each line is trim, empty lines are removed, lines are sorted
diff <(cat file1.txt | awk '{gsub(/^ +| +$/,"")}1' | grep -v '^\s*$' | sort) \
<(cat file2.txt | awk '{gsub(/^ +| +$/,"")}1' | grep -v '^\s*$' | sort)