This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var deviceInfo = { | |
'IsTablet': !!'<!--@Global:Device.IsMobile-->', | |
'IsDesktop': !!'<!--@Global:Device.IsDesktop-->', | |
'IsBot': !!'<!--@Global:Device.IsBot-->', | |
'IsAndroid': !!'<!--@Global:Device.IsAndroid-->', | |
'IsIOS': !!'<!--@Global:Device.IsIOS-->', | |
'IsWindows': !!'<!--@Global:Device.IsWindows-->', | |
'IsOther': !!'<!--@Global:Device.IsOther-->', | |
'IsIPhone': !!'<!--@Global:Device.IsIPhone-->', | |
'IsAndroidPhone': !!'<!--@Global:Device.IsAndroidPhone-->', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app> | |
<title>angular - webapp</title> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script> | |
<script type="text/javascript"> | |
function AlbumCtrl($scope, $location, $routeParams) { | |
$scope.images = [ | |
{"image":"http://pcdn.500px.net/2558330/2e1627d8a2b99d422267fd95a9e32b47c92c8668/3.jpg", "description":"Gotcha!"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Version 1.0 - 2012/07/06, by Sten Hougaard, http://twitter.com/netsi1964 | |
// Handles browsers which do not support HTML5 placeholder attribute | |
// Will setup code which emulates the HTML5 placeholder feature | |
// Require jQuery 1.7.1+ | |
// Defaults to CSS selector which hits any element using "placeholder" | |
// USE: placeholderPolyfill([selector]) | |
function placeholderPolyfill(sSelector) { | |
var bSupportsPlaceholder = 'placeholder' in document.createElement('input'); | |
if (!!bSupportsPlaceholder) return; | |
jQuery((typeof sSelector!='undefined') ? sSelector : '[placeholder]').each(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('*').css('-webkit-transition','2s all') | |
jQuery('img').hover(function() { | |
$(this).css('-webkit-transform', 'rotate3d(107, 117, 71, 397deg)') | |
}, | |
function() { | |
$(this).css('-webkit-transform', 'rotate3d(107, 117, 71, 0deg)') | |
} | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>jQuery.my boilerplate</title> | |
</head> | |
<body> | |
<div id="form"> | |
<label for="field">Enter something and it will be UPPERCASE</label> | |
<input type="text" id="field" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TO-DO: Remember to add URL | |
function flyTo(sFrom, sTo, sTime) { | |
sTime = (sTime || 2000); | |
var $from = jQuery(sFrom).clone().appendTo($('body')); | |
var $to = jQuery(sTo); | |
var fromOffset = $from.offset(); | |
var toOffset = $to.offset(); | |
$from.css({ | |
'position': 'absolute', | |
'left': fromOffset.left + 'px', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Various CANVAS experients | |
http://calebevans.me/projects/jcanvas/sandbox.php#for%28var%20i%3D0%3B%20i%3C1000%3B%20i++%29%20%7B%0A%24%28%27canvas%27%29.drawArc%28%7B%0A%20%20fillStyle%3A%20%22rgba%28200%2C0%2C0%2C.007%29%22%2C%0A%20%20x%3A%20100+Math.random%28%29*50%2C%20y%3A%20100+Math.random%28%29*50%2C%0A%20%20radius%3A%2050+Math.random%28%29*50%2C%0A%20%20start%3A%20Math.random%28%29*100+300*Math.sin%28i%29%2C%0A%20%20end%3A%20%20Math.random%28%29*100+50+300*Math.sin%28i%29%0A%7D%29.drawArc%28%7B%0A%20%20fillStyle%3A%20%22rgba%280%2C200%2C0%2C.007%29%22%2C%0A%20%20x%3A%20150+Math.random%28%29*50%2C%20y%3A%20101+Math.random%28%29*50%2C%0A%20%20radius%3A%2050+Math.random%28%29*150%2C%0A%20%20start%3A%20Math.random%28%29*100+50+300*Math.sin%28i%29%2C%0A%20%20end%3A%20%20Math.random%28%29*100+50+100+300*Math.sin%28i%29%0A%7D%29.drawArc%28%7B%0A%20%20fillStyle%3A%20%22rgba%280%2C0%2C200%2C.007%29%22%2C%0A%20%20x%3A%20125+Math.random%28%29*150%2C%20y%3A%20150+Math.random%28%29*50%2C%0A%20%20radius%3A%2050+Math.r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sten Hougaard, 2012-08-08 | |
29/05/2014 10.55: Updated | |
Extends jQuery with psedu-selector: | |
:between(iFrom, iTo) | |
Will return elements which has position between iFrom and iTo. | |
*/ | |
(function($) { | |
$.extend($.expr[':'], { | |
between: function(element, index, matches, set) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://gist.github.com/3347519 | |
function getCityFromZipCode(sZipcodeSelector, sTargetSelector, sLoadingClass) { | |
var sLoadingClass = (sLoadingClass||'loading'); | |
var $sTargetSelector = jQuery(sTargetSelector); | |
var $sZipcodeSelector = jQuery(sZipcodeSelector); | |
if ($sTargetSelector.length>0 && $sZipcodeSelector.length>0) { | |
var sZipCode = $sZipcodeSelector.val(); | |
$sTargetSelector.removeClass(sLoadingClass).addClass(sLoadingClass); | |
$.ajax({ | |
url: 'http://geo.oiorest.dk/postnumre/'+sZipCode+'.json?callback=?', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @netsi1964 23/08-2012: Simple browser detection | |
// Requires jQuery | |
// Will add browser name and version to HTML tag as class | |
// For instance: html.mozilla v14 | |
var $html = jQuery('html'); | |
jQuery.each(jQuery.browser, function(i, val) { | |
if (typeof val==='boolean' && !$html.hasClass(i)) $html.addClass(i); | |
}); | |
var version = 'v'+parseInt(jQuery.browser.version); | |
if (!$html.hasClass(version)) $html.addClass(version); |