Skip to content

Instantly share code, notes, and snippets.

View TastyToast's full-sized avatar

Donnie Conner TastyToast

View GitHub Profile
@TastyToast
TastyToast / jquery.truncatelines.js
Created May 11, 2012 22:48 — forked from cscheng/jquery.truncatelines.js
A simple jQuery plugin to truncate a piece of text to a predefined amount of lines. It assumes pixel values of both the container and its line-height. Useful when you have multiple boxes with text in your design that require equal heights.
$.fn.truncateLines = function(options) {
options = $.extend($.fn.truncateLines.defaults, options);
return this.each(function(index, container) {
container = $(container);
var containerLineHeight = Math.ceil(parseFloat(container.css('line-height')));
var maxHeight = options.lines * containerLineHeight;
var truncated = false;
var truncatedText = $.trim(container.text());
var overflowRatio = container.height() / maxHeight;
@TastyToast
TastyToast / tweet.liquid
Created May 22, 2012 18:41 — forked from andershaig/tweet.liquid
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 = {};
{% if tweet_url %}
@TastyToast
TastyToast / sharing.liquid
Created May 22, 2012 18:45 — forked from andershaig/sharing.liquid
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;
$('#method1').click( function (e) {
e.preventDefault();
window.open(full_url);
});
{% plugin rawtext desktop_url %}
<script type="text/javascript">
top.location.href="{{ desktop_url }}";
</script>