Skip to content

Instantly share code, notes, and snippets.

@dnoseda
dnoseda / gist:1311186
Created October 25, 2011 03:09
play framework error
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.2.3, http://www.playframework.org
~
~ Ctrl+C to stop
~
@dnoseda
dnoseda / Camelize.groovy
Created October 31, 2011 18:14
camelize in groovy
public String camelize(String cmdName, boolean firstUpper = false) {
def words = cmdName.split("\\_");
return (firstUpper ? capitalize(words[0]) : words[0]) + words[1..(words.size() -1)].collect({capitalize(it)}).join()
}
public String capitalize(String a){
String s = a.substring(1)
return "${a[0].toUpperCase()}${s.toLowerCase()}"
}
@dnoseda
dnoseda / gist:1343294
Created November 6, 2011 18:40
groovy ident with vim
:g/{\n/normal j>i{
@dnoseda
dnoseda / gist:1345932
Created November 7, 2011 19:43
startup jenkins
#!/bin/bash
## Check if process is already running
echo "Looking for jenkins"
pid=`ps aux | grep jenkins.war | grep -v grep | awk '{print $2}'`
echo "PID: $pid"
if [ "$pid" == "" ]
then
@dnoseda
dnoseda / 9gag-unlove.js
Created November 16, 2011 23:47
9gag-unlove.js
// bookmarklet at https://gist.github.com/1371984
javascript:(function(){
var s=document.createElement("script");
s.src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js";
s.onload=function(){
$("ul.actions").map(function(){
var id=$(this).find("a.love").attr("rel");
console.log(id);
var button="<li><a rel=\""+id+"\" id=\"unlo-"+id+"\" class=\"unlove badge-vote-down\" href=\"#\"><span>Unlove</span></a></li>";
$(this).append(button);
@dnoseda
dnoseda / 9gaghate.js
Created November 17, 2011 00:25
9gaghate.js
javascript:(function(){var%20s=document.createElement("script");s.src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js";s.onload=function(){$("ul.actions").map(function(){var%20id=$(this).find("a.love").attr("rel");console.log(id);var%20button="<li><a%20rel=\""+id+"\"%20id=\"unlo-"+id+"\"%20class=\"unlove%20badge-vote-down\"%20href=\"#\"><span>Unlove</span></a></li>";$(this).append(button);});$("a.unlove").click(function(e){e.preventDefault();var%20id=$(this).attr("rel");$.get("http://9gag.com/vote/dislike/id/"+id,function(){$("#unlo-"+id).addClass("unloved");});});};document.body.appendChild(s);})()
var s=document.createElement("script");
s.src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js";
s.onload=function(){
$("ul.actions").map(function(){
var id=$(this).find("a.love").attr("rel");
console.log(id);
var button="<li><a rel=\""+id+"\" id=\"unlo-"+id+"\" class=\"unlove badge-vote-down\" href=\"#\"><span>Unlove</span></a></li>";
$(this).append(button);
});
$("a.unlove").click(function (e){
@dnoseda
dnoseda / gist:1372197
Created November 17, 2011 02:32
Saving macro in .vimrc
"macro for bookmarkletizise a js
let @b='ggOjavascript:(function(){^[G}Go})()^[ggvG1000<:%s/ /%20/g^M:%s/\n//g^M'
#!/bin/sh
#find $1 -type f -print0 | xargs -0 sed -i 's/$2/$3/g'
echo $1 $2 $3
grep -rl $2 $1 | while read fn; do
echo "replacing in $fn $2 for $3"
sed -i "s/$2/$3/g" $fn
done
window.twttr=window.twttr||{};
var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,u=encodeURIComponent(F.location.href),t=encodeURIComponent(F.title);
if(C>A){
G=Math.round((C/2)-(A/2))
}
window.twttr.shareWin=window.open('http://linksdeviernes.com/add.php?url='+u+'&titulo='+t,'','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');