This file contains 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
/** | |
Quick and dirty plugin to generate qr code on the fly | |
@author Frederick King | |
**/ | |
(function($, undefined) { | |
/** | |
Generate qr code on the fly | |
@parameter {object} options | |
**/ | |
$.fn.qrCode = function(options) { |
This file contains 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
// Evaluates a script in a global context | |
// Workarounds based on findings by Jim Driscoll | |
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context | |
// pulled from jquery.core source | |
var globalEval = function( data ){ | |
if ( data ) { | |
// We use execScript on Internet Explorer | |
// We use an anonymous function so that context is window | |
// rather than jQuery in Firefox |
This file contains 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
protected string file_get_contents(string fileName) | |
{ | |
string sContents = string.Empty; | |
if (fileName.ToLower().IndexOf("http:") > -1){ | |
// URL | |
System.Net.WebClient wc = new System.Net.WebClient(); | |
byte[] response = wc.DownloadData(fileName); | |
sContents = System.Text.Encoding.ASCII.GetString(response); | |
} else { |
This file contains 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
// Based on code from the following sources: | |
// * http://www.voiceoftech.com/swhitley/index.php/2009/03/twitter-oauth-with-net/ | |
// * http://oauth.googlecode.com/svn/code/csharp/ | |
// Note: if you're using mono the following command will compile this code `gmcs -r:System.Web.dll this_file.cs` | |
using System; | |
using System.Security.Cryptography; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.Net; |
This file contains 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
(function( undefined ){ | |
/* Apple Device Webkit Browsers */ | |
var isIdevice = /(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent); | |
if (isIdevice){ | |
document.getElementsByTagName('body')[0].className += ' iphone ipod ipad'; | |
} | |
var isIphone = /(iPhone).*AppleWebKit/i.test(navigator.userAgent); | |
if (isIphone){ | |
document.getElementsByTagName('body')[0].className += ' iphone'; |
This file contains 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
/** | |
* @class | |
* @description | |
* Wrapper for HTML5 audio. | |
*/ | |
import {Injectable, NgZone} from 'angular2/core'; | |
import {Observer} from 'rxjs/Observer'; | |
import {Observable} from 'rxjs/Observable'; | |
declare var AudioContext:any; |
This file contains 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 UpdateQueryStringParameter = function(uri, key, value) { | |
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); | |
var separator = uri.indexOf('?') !== -1 ? "&" : "?"; | |
if (uri.match(re)) { | |
return uri.replace(re, '$1' + key + "=" + value + '$2'); | |
} | |
else { | |
return uri + separator + key + "=" + value; | |
} | |
}; |
This file contains 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
Number.prototype.formatMoney = function(c, d, t){ | |
var | |
n = this, | |
c = isNaN(c = Math.abs(c)) ? 2 : c, | |
d = d == undefined ? "," : d, | |
t = t == undefined ? "." : t, | |
s = n < 0 ? "-" : "", | |
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", | |
j = (j = i.length) > 3 ? j % 3 : 0; | |
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ""); |
This file contains 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
/** | |
* Weather Forecast Plugin | |
* Author: Frederick King | |
* | |
**/ | |
(function(window, document, $, undefined) { | |
var api = { | |
load: function(zip, $elem) { | |
var self = this; | |
// XDomain Request for IE8/IE9 :( |
This file contains 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 generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
NewerOlder