Skip to content

Instantly share code, notes, and snippets.

View toadkicker's full-sized avatar
🏠
Let's fix some stuff

Todd Baur toadkicker

🏠
Let's fix some stuff
View GitHub Profile

Project

Description: What does this project do and who does it serve?

Project Setup

How do I, as a developer, start working on the project?

  1. What dependencies does it have (where are they expressed) and how do I install them?
  2. How can I see the project working before I change anything?
# Automatic create and set html hidden field
# base on Bootstrap buttons radio values
# Javascript/Coffeescript plugin
#
# Html/Slim
# .btn-group data-toggle='buttons-radio' data-field='offer[type]' data-init-val=@offer.type
# a.btn href='#' data-val='flat' Flat
# a.btn href='#' data-val='house' House
#
# Usage
@toadkicker
toadkicker / gist:6031104
Created July 18, 2013 17:14
Convert old ruby hash syntax to new
find . -type f -iname '*.rb' | xargs ruby -i -pe 'gsub(/(?<!:):(\w+)\s*=>\s*/, "\\1: ")
@toadkicker
toadkicker / gist:6016984
Created July 17, 2013 01:42
check for element and stop checking when done
var checkExist = setInterval(function() {
if ($('#the-canvas').length) {
console.log("Exists!");
clearInterval(checkExist);
}
}, 100);
@toadkicker
toadkicker / gist:6003393
Created July 15, 2013 20:56
DOM searching for a string
var search = document.evaluate('//text()[contains(., \"username\")]',
document, null, XPathResult.ANY_TYPE, null);
// Example:
JavaScript.load("/javascripts/something.js");
// With callback (that’s the good thing):
JavaScript.load("http://www.someawesomedomain.com/api.js", function() {
API.use(); // or whatever api.js provides ...
});
@toadkicker
toadkicker / gist:5827724
Created June 20, 2013 23:37
I wanted a way to have an inner gradient in a button with CSS3, and started working on input type="button"
<!DOCTYPE html>
<html>
<head>
<title>Fun with Buttons</title>
<style>
/*structure*/
.button, input[type="button"] {
box-shadow: .1em .2em .5em #aaa;
height: 22px;
display: block;
@toadkicker
toadkicker / gist:5822980
Last active December 18, 2015 17:59
jQuery vs native
//ajax
$.ajax({
url: '/endpoint'
}).done(function(data){
// do something awesome
}).fail(function(xhr){
// sad little dance
});
var xhr = new XMLHttpRequest();
# Install Dependencies
# sudo apt-get install build-essential
# sudo apt-get build-dep php5
sudo apt-get install libmysqlclient-dev mysql-client libcurl4-openssl-dev libgd2-xpm-dev libjpeg-dev libpng3-dev libxpm-dev libfreetype6-dev libt1-dev libmcrypt-dev libxslt1-dev bzip2 libbz2-dev libxml2-dev libevent-dev libltdl-dev libmagickwand-dev libmagickcore-dev imagemagick libreadline-dev libc-client-dev libsnmp-dev snmpd snmp libvpx-dev libxpm-dev libgmp3-dev libicu-dev libpspell-dev libtidy-dev freetds-dev unixodbc-dev librecode-dev libglib2.0-dev libsasl2-dev libgeoip-dev imagemagick libmagickcore-dev libmagickwand-dev
# Stop Apache
sudo service apache2 stop
# Cleanup Packages
sudo apt-get autoremove
@toadkicker
toadkicker / gist:5768516
Created June 12, 2013 19:52
delay(function, time)
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();