Skip to content

Instantly share code, notes, and snippets.

@andershaig
andershaig / pulse.css
Created April 24, 2012 17:53
Animated Pulse
#backlight {
position:absolute;
top:150px;
left:150px;
width:0;
height:0;
-webkit-border-radius: 150px;
-moz-border-radius: 150px;
border-radius: 150px;
-webkit-box-shadow:0 -15px 90px 35px rgba(0,255,255,0.5),
@andershaig
andershaig / img2canvas.js
Created May 2, 2012 22:51
Image to Canvas with CORS
var img = document.createElement('img');
img.onload = function(e) {
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
var url = canvas.toDataURL(); // Succeeds. Canvas won't be dirty.
};
img.crossOrigin = 'anonymous';
img.src = 'http://other-domain.com/image.jpg';
@andershaig
andershaig / sharing.liquid
Created May 15, 2012 14:36
Sharing Popup using Facebook's Share Method
<script type="text/javascript">
$(document).ready( function () {
var url = encodeURIComponent('https://www.youtube.com/watch?v=ya7OVaIu7Yg');
var title = encodeURIComponent('This is my super awesome title');
var full_url = 'http://www.facebook.com/sharer.php?u=' + url + '&t=' + title;
$('#fb_share').click( function (e) {
e.preventDefault();
window.open(full_url);
});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JSON to CSV</title>
<script src="scripts/json.js" type="text/javascript"></script>
<script type="text/javascript">
var json3 = { "d": "[{\"Id\":1,\"UserName\":\"Sam Smith\"},{\"Id\":2,\"UserName\":\"Fred Frankly\"},{\"Id\":1,\"UserName\":\"Zachary Zupers\"}]" }
DownloadJSON2CSV(json3.d);
@andershaig
andershaig / tweet.liquid
Created May 22, 2012 18:08
Twitter Intents with Rawtext
<button id="tweet_button">Click to Tweet</button>
<script type="text/javascript">
{% plugin rawtext tweet_url %}
{% plugin rawtext tweet_text %}
{% plugin rawtext tweet_hashtags %}
var params = {};
// Note: until we get support for escaping single quotes, they can't be used in the message.
@andershaig
andershaig / autofill.liquid
Created May 23, 2012 22:28
LinkedIn Autofill
<script type="text/javascript">
function onLinkedInAuth() {
$('#linkedin_section').hide();
IN.API.Profile("me")
.fields("id","first-name","last-name","location","public-profile-url")
.result( function(me) {
var user_id = me.values[0].id;
var fname = me.values[0].firstName;
var lname = me.values[0].lastName;
@andershaig
andershaig / refresh.js
Created May 26, 2012 02:37
Force Refresh Page after AJAX
$(document).bind('didRefreshWidgetContent', function () {
top.location.href = top.location.href;
});
@andershaig
andershaig / Test URLs
Created June 7, 2012 20:46
Standard Media Queries
Canvas: http://apps.facebook.com/wf-polls/pages/cb4abc1ff159d6550265a79e36f66e73
Microsite: https://apps.wildfireapp.com/microsite/pages/cb4abc1ff159d6550265a79e36f66e73
Fan Page: https://www.facebook.com/pages/Generic-T/302915683055517?sk=app_160731467314127
Mobile: https://apps.wildfireapp.com/fbmobile/5/pages/cb4abc1ff159d6550265a79e36f66e73
@andershaig
andershaig / add_classes.js
Created June 11, 2012 19:15
Add Page Classes
function checkWidth() {
var iframeWidth = $(window).width();
if (iframeWidth > 700) {
$('body').addClass('is_timeline');
} else {
$('body').removeClass('is_timeline');
}
};
@andershaig
andershaig / style.css
Last active October 6, 2015 01:28
Common CSS Snippets
/* selector { css: value; } */
.container { height: 800px; }
/* 3 Column Galleries to 4 Column */
.row .span4 {
width: 23.333333333333%;
*width: 23.28014184397129%;
}