Skip to content

Instantly share code, notes, and snippets.

@yahelc
yahelc / jsfiddle-jquery-defaults.user.js
Created September 8, 2011 13:36 — forked from mathiasbynens/jsfiddle-defaults.user.js
Userscript that enables jQuery-friendly defaults for jsFiddle.
// ==UserScript==
// @name Sensible defaults for jsFiddle.
// @author Mathias Bynens <http://mathiasbynens.be/>
// @modified-by Yahel Carmon
// @link http://mths.be/bde
// @match http://jsfiddle.net/*
// ==/UserScript==
if(window.location.pathname === "/") //only on new Fiddles
{
@yahelc
yahelc / gist:1125219
Last active August 25, 2016 15:15
sharedcount bookmarklet
javascript:void(function(){window.open("https://www.sharedcount.com/#url="+encodeURIComponent(location.href));}());
@yahelc
yahelc / gist:1062772
Created July 4, 2011 00:52
FollowTheRedirect.AppSpot.com source
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@yahelc
yahelc / gist:1004702
Created June 2, 2011 16:02
Simpler Twitter Intents / Google Analytics Script
(function(){
var event_names = {
"click" : "" ,
"tweet" : "",
"retweet" : "source_tweet_id",
"follow" : "screen_name",
"favorite" : "tweet_id"
};
for(var event_name in event_names)
window.onerror_old = window.onerror;
window.onerror = function (msg, url, line) {
if(window.onerror_old){ window.onerror_old(); }
_gaq = _gaq || [];
_gaq.push(['_trackEvent', 'Error Log', msg, url+'_'+line]);
};
@yahelc
yahelc / Twitter Hashtag to SMS.php
Created February 15, 2011 19:09
Searches for a hashtag in a set list of users' timelines, and SMSes the contents to a number using Twilio API. Uses basic MySQL store for preventing duplicate SMSes. Uses fancy tweet entities for hashtag detection.
<?php
$link = mysql_connect('localhost', 'username', 'password');
mysql_select_db('database_name');
$users = array('user_a', 'user_b', 'user_c', 'user_d'); //twitter handles, must be public timelines
$post_array = array('To'=>('1XXX5551234'), 'From'=>('1XXX5551234')); //FROM must be a Twilio-purchased #
$followed_hashtag = 'blahblah'; //will follow #blahblah hashtag in the users tweets
foreach($users as $user)
{
$url = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=" . $user . '&include_entities=true&trim_user=true';
$user_stream = json_decode(file_get_contents($url), true);
jQuery('#cc_number').bind('keypress, keyup', function(){
var first = parseInt(jQuery(this).val().charAt(0), 10);
if(first==3) //amex
{
jQuery('#cc_ax').attr('checked', 'checked');
}
else if(first == 4) //visa
{
jQuery('#cc_vs').attr('checked', 'checked');