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
@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 / facebook_fucked_up.js
Created August 19, 2011 00:43
Scrape all friends from autocomplete on FB
var payload = {} || payload;
window.jQuery || document.write('<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"><\/script>');
payload.init = function () {
$.ajax({
url: "//www.facebook.com/ajax/typeahead/search/first_degree.php",
data: "__a=1&filter[0]=user&lazy=0&viewer=" + Env.user + "&token=v7&stale_ok=0",
dataType: 'JSON',
error: function (data) {
var text, json, endgame;
@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;
@buzzedword
buzzedword / plugins.js
Created October 26, 2011 18:24
Useful plugins found in my travels...
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
<!DOCTYPE html>
<html>
<head>
...
<link href="style.min.less" rel="stylesheet" />
</head>
<body>
...
</body>
</html>