Skip to content

Instantly share code, notes, and snippets.

@emayk
emayk / jquery.hovercard.min.js
Created March 29, 2012 12:02
js : jquery.hovercard.min.js
(function (a) { a.fn.hovercard = function (b) { var c = { width: 300, openOnLeft: false, openOnTop: false, cardImgSrc: "", detailsHTML: "", twitterScreenName: "", showTwitterCard: false, facebookUserName: "", showFacebookCard: false, showCustomCard: false, customCardJSON: {}, customDataUrl: "", background: "#ffffff", delay: 0, onHoverIn: function () { }, onHoverOut: function () { } }; var b = a.extend(c, b); if (a("#css-hovercard").length <= 0) { var d = '<style id="css-hovercard" type="text/css">' + ".hc-preview { position: relative; display:inline; }" + ".hc-name { font-weight:bold; position:relative; display:inline-block; }" + ".hc-details { left:-10px; margin-right:80px; text-align:left; font-family:Sans-serif !important; font-size:12px !important; color:#666 !important; line-height:1.5em; border:solid 1px #ddd; position:absolute;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;top:-10px;padding:2em 10px 10px;-moz-box-shadow:5px 5px 5px #888;-webkit-box-shadow:5px 5px 5px #888;box-shadow
@emayk
emayk / jquery.hovercard.js
Created March 29, 2012 12:04
jquery.hovercard.js
//Title: Hovercard plugin by PC
//Documentation: http://designwithpc.com/Plugins/Hovercard
//Author: PC
//Website: http://designwithpc.com
//Twitter: @chaudharyp
//
//Version 1.0 Aug 31st 2011 -First Release.
//Version 1.1 Sep 29th 2011
//Bug fixed: When using hovercard in hovercard, the inner hovercard shows up as well when parent hovercard opens.
//
@emayk
emayk / gist:2280638
Created April 2, 2012 04:08
jquery : sample load jquery ui with partial content
$('#tabs').tabs({
select: function(event, ui) {
var $tabAnchor = $(ui.tab);
if (ui.index == 0 && !$tabAnchor.data('completed')) {
$($tabAnchor.attr('href')).load($tabAnchor.data('content-url'), function() {
// indicate the content has been loaded
$tabAnchor.data('completed', true);
});
}
}
@emayk
emayk / remote-typeahead.js
Created July 19, 2012 08:04 — forked from geuis/remote-typeahead.js
Remote data querying for Twitter Bootstrap 2.0 Typeahead without modifications
<script>
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it.
// The following will allow remote autocompletes *without* modifying any officially released core code.
// If others find ways to improve this, please share.
var autocomplete = $('#searchinput').typeahead()
.on('keyup', function(ev){
ev.stopPropagation();
@emayk
emayk / README.markdown
Created July 19, 2012 08:05 — forked from jrust/README.markdown
Bootstrap's Typeahead plugin extended (AJAX functionality, comma-separated values, autowidth, and autoselect)

This is a fork of a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

  • Ability to disable autoselect of first matched element.
  • Ability to automatically set the width of the dropdown to that of the text input.
  • Ability to fetch source element via AJAX
  • Ability to have a comma separated list of tags.

For the proper source, and other examples, please see the original gist.

Example showing off all the above features

@emayk
emayk / pagination.php
Created July 19, 2012 08:05 — forked from yaranaio/pagination.php
Twitter bootstrap was applied to the CodeIgniter Pagination
<?php
$config['first_link'] = false;
$config['next_link'] = '次へ >>';
$config['prev_link'] = '<< 前へ';
$config['last_link'] = false;
$config['full_tag_open'] = '<div class="pagination"><ul>';
$config['full_tag_close'] = '</ul></div>';
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>;';
@emayk
emayk / snippet.js
Created July 19, 2012 08:07 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
<html>
<head>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<head>
<body>
<script>
$(document).ready(function () {
// Cross domain ajax (uses YQL)
@emayk
emayk / date.js
Created July 19, 2012 10:30 — forked from litzinger/date.js
Cross Domain XML to JSON
/*
* JavaScript Pretty Date
* Copyright (c) 2011 John Resig (ejohn.org)
* Licensed under the MIT and GPL licenses.
*/
// Takes an ISO time and returns a string representing how
// long ago the date represents.
function prettyDate(time){
var date = new Date((time || "").replace(/-/g,"/").replace(/[TZ]/g," ")),
@emayk
emayk / gist:3142923
Created July 19, 2012 10:32
pretydate.js
/*
* JavaScript Pretty Date
* Copyright (c) 2011 John Resig (ejohn.org)
* Licensed under the MIT and GPL licenses.
*/
// Takes an ISO time and returns a string representing how
// long ago the date represents.
function prettyDate(time){
var date = new Date((time || "").replace(/-/g,"/").replace(/[TZ]/g," ")),