Skip to content

Instantly share code, notes, and snippets.

@ljepson
ljepson / git.sh
Created July 4, 2012 06:11
Create links for all files stored in git to your local dot files. You can now keep backups on git with ease.
#!/bin/bash
mkdir -p $HOME/git/dotfiles/vim;
files=("bash_profile bashrc inputrc screenrc vim vimrc zshrc");
for file in $files; do
if [[ -h $HOME/.$file ]]; then
unlink $HOME/"."$file;
elif [[ -e $HOME/.$file ]]; then
@ljepson
ljepson / html_no_quotes.vim
Created July 5, 2012 15:58
Vim search and replace example=test to example="test"
:%s/\(\w\+=\)\([a-zA-Z0-9\#-_]\+\)/\1"\2"/egci
@ljepson
ljepson / html_single_quotes.vim
Created July 5, 2012 15:57
Vim search and replace example='test' to example="test"
:%s/\(\w\+=\)\('\)\([a-zA-Z0-9\#-_]\+\)\('\)/\1"\3"/egci
@ljepson
ljepson / fast_search.js
Last active October 6, 2015 21:48
Find any element Javascript
// Put in the element you want to find.
var el = document.getElementsByTagName("a"),
// Enter your search term
st = 'whatever',
// Results will go here when done
res;
for(var i = 0; i < el.length; i++) {
// Checking to see if the returned element's innerText matches the search term
if(el[i].innerText === st) {
// Results have been saved if anything was found. You can now use the variable res to do whatever you'd like
@ljepson
ljepson / gvoice.old.js
Created July 6, 2012 05:48
Automate clicking "Select All" checkbox in Google Voice
setInterval(function() { if(!$jq('.jfk-checkbox-checkmark').parent().hasClass('jfk-checkbox-checked') && $jq('#gc-message-list .gc-message').html().length > 1) { $jq('.jfk-checkbox-checkmark').click(); } },1000);
@ljepson
ljepson / godville.js
Created December 1, 2012 04:23
GodvilleGame.com Autobot
var godville = {
delay: 3000,
init: function() {
$('body').append('<aside id="autobot">');
$('#autobot').append('<p>Select an option from below to start botting</p>');
$('#autobot').append('<input type="radio" id="auto_encourage" name="autobot"><label for="auto_encourage">Automatically encourage</label>');
$('#autobot').append('<input type="radio" id="auto_punish" name="autobot"><label for="auto_punish">Automatically punish</label>');
$('#autobot').append('<button>Stop autoing</button>');
$('#autobot').css({
background: 'rgba(255,255,255,.45)',
@ljepson
ljepson / bing.js
Created December 14, 2012 06:09
Automatically do the amount of searches necessary to get the maximum number of daily credits from bing.com.
var bing = {
credits: 0,
current_status: function() {
var current_credits = bing.credits;
jQuery.ajax({url: '/rewards/dashboard', success: function(d) {
var credits = jQuery(d).find('.title:contains("Search Bing")').closest('a').find('.progress').text();
if(!credits.match(/.*of.*/)) bing.settings['stop'] = true;
bing.credits = Number(credits.replace(/(\d+).*/,'$1'));
bing.total = Number(jQuery(d).find('.user-balance .data-value-text:first').text());
}, complete: function() {
@ljepson
ljepson / random_selector.js
Created December 14, 2012 07:58
Select a number at random based on the frequency that it randomly showed up.
Array.prototype.frequency = function() {
this.sort();
var i = 0, array, count, item, first = this.slice(0);
while(i < first.length) {
count = 1; item = first[i]; array = i + 1;
while(array < first.length && (array = first.indexOf(item, array)) !== -1) {
count += 1; first.splice(array,1);
}
first[i] += ' : '+ count; i++;
}
@ljepson
ljepson / dropbox.js
Last active December 14, 2015 21:49 — forked from anonymous/dropbox.js
;(function($) {
var check_button = function() { return $('#load-more-bonus').is(':visible') };
var referral_count = function() {
if(check_button()) {
$('#load-more-bonus').click();
setTimeout(referral_count,1000);
} else {
$('.bonus-row a').filter(function() {
return $(this).text() !== 'Referral' ? 1 : 0;
}).closest('.bonus-row').remove();
function deobfuscate(convert) {
var code;
var convert_list = convert.split(/,/);
for(var i = 0; i < convert_list.length; i++) {
var char = String.fromCharCode(convert_list[i]);
code = code ? code + char : char;
}
console.log(code);
}