Skip to content

Instantly share code, notes, and snippets.

View dieseltravis's full-sized avatar
🆗
I'm ok

Travis Hardiman dieseltravis

🆗
I'm ok
View GitHub Profile
@dieseltravis
dieseltravis / powershell.json
Created May 9, 2018 17:20 — forked from rkeithhill/powershell.json
PowerShell snippets file for Visual Studio Code - place in your ~\AppData\Roaming\Code\User\Snippets directory
{
"Condition statement": {
"prefix": "cond",
"body": [
"${_} { ${0}; break }"
],
"description": "Switch condition statement"
},
"Condition single quoted string statement": {
@dieseltravis
dieseltravis / cookiebot.js
Last active December 24, 2015 01:29 — forked from jeresig/cookiebot.js
cookie clicker bot, you're too much fun
CookieBot = {
click: function clicker() {
clearInterval(this.clickInterval);
this.clickInterval = setInterval(function clickIntervaller() {
// Click the large cook as fast as possible!
$("#bigCookie").click();
}, 1);
// limit this to 15 for hidden achievement?
//TODO: test for achievement or clicks >= 15 use above, otherwise use below
if (!navigator.geolocation) {
navigator.geolocation = (function (window, document) {
function getCurrentPosition(callback) {
var geourl = 'http://www.google.com/jsapi?' + Math.random(),
iframe = document.createElement('iframe'),
doc, win;
iframe.style.display = 'none';
window.document.body.appendChild(iframe);
setInterval((function () {
console.log(new Date()); // run some arbitrary code
return arguments.callee; // here be the magic
})(), 1000);
// ^---- and that runs the function, and the return val is assign to the interval
//EnhanceJS isIE test idea
//detect IE and version number through injected conditional comments (no UA detect, no need for cond. compilation / jscript check)
//version arg is for IE version (optional)
//comparison arg supports 'lte', 'gte', etc (optional)
function isIE(version, comparison) {
var cc = 'IE',
b = document.createElement('B'),
// dbjdbj@gmail.com
// Based on work by http://github.com/dieseltravis
(function () {
var trimLeft = /^\s+/, trimRight = /\s+$/;
// Verify that \s matches non-breaking spaces (IE fails on this test)
if ( !/\s/.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// Use native String.prototype.trim function wherever possible
@dieseltravis
dieseltravis / jquery.fastertrim.js
Created March 4, 2010 22:44 — forked from dcneiner/jquery.fastertrim.js
Doug saves the day with a more streamlined plugin and feature suggestions
/*
* jQuery fasterTrim Plugin
* version: 1.0.5
* @requires jQuery v1.0.x or later
*
* dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/gpl-2.0.php
*
* @version $Id: jquery.fastertrim.js 5 2010-03-12 12:00:00Z $
// bookmarklet to introspect the source of current page
javascript:(function(d,h){h=d.documentElement.innerHTML;d.open();d.write('<pre>'+('<!DOCTYPE html><html>'+h+'</html>').replace(/[<>]/g,function(m){return{'<':'&lt;','>':'&gt;'}[m]})+'</pre>')})(document);