Skip to content

Instantly share code, notes, and snippets.

Avatar

Lonny ljepson

  • Utah
View GitHub Profile
@ljepson
ljepson / git.sh
Created Jul 4, 2012
Create links for all files stored in git to your local dot files. You can now keep backups on git with ease.
View git.sh
#!/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_single_quotes.vim
Created Jul 5, 2012
Vim search and replace example='test' to example="test"
View html_single_quotes.vim
:%s/\(\w\+=\)\('\)\([a-zA-Z0-9\#-_]\+\)\('\)/\1"\3"/egci
@ljepson
ljepson / html_no_quotes.vim
Created Jul 5, 2012
Vim search and replace example=test to example="test"
View html_no_quotes.vim
:%s/\(\w\+=\)\([a-zA-Z0-9\#-_]\+\)/\1"\2"/egci
@ljepson
ljepson / gvoice.old.js
Created Jul 6, 2012
Automate clicking "Select All" checkbox in Google Voice
View gvoice.old.js
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 / fast_search.js
Last active Oct 6, 2015
Find any element Javascript
View fast_search.js
// 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 / ln.sh
Created Aug 5, 2012
Create symlinks for my dotfiles
View ln.sh
#!/bin/bash
ln -s ~/git/dotfiles/bash_profile ~/.bash_profile;
ln -s ~/git/dotfiles/bashrc ~/.bashrc;
ln -s ~/git/dotfiles/inputrc ~/.inputrc;
ln -s ~/git/dotfiles/screenrc ~/.screenrc;
ln -s ~/git/dotfiles/vimrc ~/.vimrc;
ln -s ~/git/dotfiles/zshrc ~/.zshrc;
@ljepson
ljepson / gvoice.js
Created Nov 25, 2012
Google Voice Delete
View gvoice.js
var voice = {
jquery: '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js',
key_name: '_rnr_se',
key_value: function() {return jQuery('input[name="'+ voice.key_name +'"]').val()},
page: 1,
messages: [],
done: false,
init: function() {
var script = document.createElement('script'),
head = document.getElementsByTagName('head')[0];
@ljepson
ljepson / godville.js
Created Dec 1, 2012
GodvilleGame.com Autobot
View godville.js
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 Dec 14, 2012
Automatically do the amount of searches necessary to get the maximum number of daily credits from bing.com.
View bing.js
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 Dec 14, 2012
Select a number at random based on the frequency that it randomly showed up.
View random_selector.js
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++;
}
You can’t perform that action at this time.