Skip to content

Instantly share code, notes, and snippets.

View buzzedword's full-sized avatar
:octocat:
Live and in stereo

Danny Garcia buzzedword

:octocat:
Live and in stereo
View GitHub Profile
jQuery.getScript('http://code.jquery.com/jquery-latest.min.js', function(){
$('iframe#appFrame').contents().find('button[name|="No, thanks"]').click();
});
@buzzedword
buzzedword / jquery.IOS.js
Created July 1, 2011 03:52
jQuery.browser extension to include mobile safari.
jQuery.extend(jQuery.browser,
{
IOS : navigator.userAgent.toLowerCase().match(/iP(hone|ad|od)/i)
}
);
// ...
if ($.browser.IOS) {
// Do something IOS-y
@buzzedword
buzzedword / plus.google.com.js
Created July 11, 2011 16:04
Default Circles
(function($){
var ns = {};
ns.snoop = function(defaultStreamID){
if (window.location.pathname == "/"){
window.location = "https://plus.google.com/stream/cicles/" + defaultStreamID;
} else {
//
}
};
$(window).ready(function(){
@buzzedword
buzzedword / ellipsis.js
Created July 20, 2011 18:40 — forked from qwertypants/ellipsis.js
Add ellipsis to any text. Choose amount of words to show.
String.prototype.ellipsis = function(numOfWords, _text, wordCount ) {
_text = this;
wordCount = _text.trim().replace(/\s+/g, " ").split(' ').length;
_text = _text.trim().split(' ');
_text.splice(numOfWords, wordCount, "...");
return _text.join(' ');
}
@buzzedword
buzzedword / web-sql.js
Created September 26, 2011 23:03
Messing around with Web SQL API
(function($, undefined){
var ns = {}, db = openDatabase('learning_js',
'1.0',
'Database to create on tinkerbin',
2 * 1024 * 1024);
ns.createDB = function(){
db.transaction(function(tx) {
tx.executeSql("CREATE TABLE IF NOT EXISTS 'primary' (id unique, text)");
});
};
@buzzedword
buzzedword / index.php
Created October 4, 2011 21:42
Debug a Facebook App from remote console
<?php
// $environment = 'dev';
if (isset($_GET['jsconsole']) $termID = $_GET['jsconsole'];
?>
<!DOCTYPE html>
<head>
<title>Remote Debugging on Facebook</title>
<?php if ($environment === 'dev' && isset($termID)) { ?>
<script src="http://jsconsole.com/remote.js?<?php echo $termID; ?>"></script>
<?php } ?>
@buzzedword
buzzedword / .gitconfig
Created October 5, 2011 19:45
Public Global .gitconfig
[user]
name = John Doe
email = user@email.place
[color]
ui = true
status = auto
branch = auto
[alias]
st = status
@buzzedword
buzzedword / timer.js
Created October 20, 2011 19:56 — forked from wayko/timer
timer
var newYear = new Date(new Date().getFullYear() + 1, 1 - 1, 1);
$(document).ready(function(){
$('#defaultCountdown').countdown({until: newYear});
$('#removeCountdown').toggle(function() {
$(this).text('Re-attach');
$('#defaultCountdown').countdown('destroy');
}, function() {
$(this).text('Remove');
@buzzedword
buzzedword / gist:1317242
Created October 26, 2011 18:20
Add indexOf to all IE versions under IE9
<!--[if lt IE 9]>
<script>
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this === void 0 || this === null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
@buzzedword
buzzedword / getScriptWrapper.jquery.js
Created October 26, 2011 18:23
Wraps getScript to inline all code, no matter where it came from.
jQuery.extend({
getScript: function(url, callback) {
var head = document.getElementsByTagName("head")[0],
script = document.createElement("script");
script.src = url;
// Handle Script loading
{
var f = false;