Skip to content

Instantly share code, notes, and snippets.

@bojanbjelic
bojanbjelic / spider-urls.sh
Created February 14, 2013 10:37
spider unique URLs on pages, starting from one URL
wget --spider --force-html -r -l1 http://tigar.ir.ttweb.net/ 2>&1 | grep '^--' | awk '{ print $3 }' | grep -v '\.\(css\|txt\|png\|gif\|jpg\|js\)$' | sort --unique
@bojanbjelic
bojanbjelic / git-assume-unchanged.sh
Created January 26, 2013 01:32
git: temporarily ignore local changes
git update-index --assume-unchanged database.php
@bojanbjelic
bojanbjelic / fixuser.sql
Created January 26, 2013 00:08
Fix strange mysql ownership issues.
UPDATE `mysql`.`proc` p SET definer = 'user@localhost' WHERE definer='user@%' AND db='DB';
@bojanbjelic
bojanbjelic / selectElementsFromAjaxResponse.js
Last active June 18, 2018 10:58
Selecting Elements Returned From Jquery Ajax Response Strings
$(function () {
$.get('contentUrl', function (response) {
var source = $('<div>' + response + '</div>');
$('#target').empty().append(
$('<div/>')
.append(response)
.find('#selectorInResult');
);
});
});
sudo dpkg --remove --force-remove-reinstreq pkg_name
@bojanbjelic
bojanbjelic / flushdns.sh
Created December 2, 2012 23:21
mac osx lion flush DNS cache
sudo killall -HUP mDNSResponder
@bojanbjelic
bojanbjelic / rss-dl-mp3.sh
Created November 19, 2012 23:35
download mp3s from a rss feed
wget [RSS URL]
grep -e '[^"]*\.mp3' [downloaded RSS] | grep -o '[^"]*\.mp3' '-' >> list.txt
wget -i list.txt
@bojanbjelic
bojanbjelic / cleanup.sh
Created November 18, 2012 00:37
cleanup email html
perl -pi -w -e 's/=3D/=/g;' $1
perl -pi -w -e 's/(=\r\n)|=20|=0D|=09//g;' $1
@bojanbjelic
bojanbjelic / gist:3944576
Created October 24, 2012 07:35
Remove whitespace around text fields
input,
textarea {
margin:0;
vertical-align:bottom;
}
/*
If you want to affect only text inputs you could use input[type="text"] instead of input. Other values for vertical-align, like top or middle, will also work.
*/
@bojanbjelic
bojanbjelic / gist:3931503
Created October 22, 2012 13:27
jQuery ajax wait pattern
function getTwoThings( callback ) {
var peopleRequest = $.getJSON( '/data/people.json' );
var taskRequest = $.getJSON( '/data/tasks.json' );
$.when( peopleRequest, taskRequest )
.done(function( people, tasks ) {
callback( people[0].people, tasks[0].tasks );
});
}