Skip to content

Instantly share code, notes, and snippets.

View albertpak's full-sized avatar

Albert Pak albertpak

View GitHub Profile
@albertpak
albertpak / AngularJS
Last active December 20, 2015 03:59
Links to AngularJS lessons, tutorials and useful material I'll be adding links in there as I come across useful information on AngularJS
http://angularjschicago.github.io/angular-tips-and-tricks
http://www.egghead.io
http://www.thinkster.io
http://briantford.com/blog/huuuuuge-angular-apps.html
$("#frmButtons\\:btnExportWord").click(function (e) {
//track the event
_gaq.push(['_trackEvent', 'Decode', 'Decode copying', 'Export to Word']);
var button = $(this);
//create a delay and call the same click
if (button.data('tracked') != 'true') {
e.preventDefault(); //consume event if not tracked yet
setTimeout( function(){
button.data('tracked', 'true');
@albertpak
albertpak / daysoftheweek.html
Created August 8, 2013 21:10
How to disable (or enable - reverse true/false in nonPartyDays function ) days of the week in jQuery UI Datepicker based on which days are checked off.
<table id="daysoftheweek">
<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thu</th>
<th>Fri</th>
<th>Sat</th>
</tr>
jQuery(window).ready(slideshowResize);
jQuery(window).resize(slideshowResize);
//function to resize and center images and slideshow
function slideshowResize() {
//SET CUSTOM VARIABLES
//set ratio value by dividing the images width by it height
//* I usually round this to 2 decmials
var imageRatio = "1.75";
//set containerName equal to the div containing the image or slideshow function will use this div to set height and width so use 100% width or height for responsive demensions
# Avoid annoying ActionController::UnknownHttpMethod exceptions like:
#
# ActionController::UnknownHttpMethod) "CONNECT, accepted HTTP methods are get, head, put, post, delete, and options"
#
# Install this file in app/metal and these requests will receive a 405
# "Method Not Allowed" status and will be logged under `info'.
class IgnoreUnknownHttpMethod
def self.call(env)
[
if ActionController::Request::HTTP_METHODS.include?(env["REQUEST_METHOD"].downcase)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>jeditable + bootstrap datepicker custom type demo</title>
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://raw.github.com/eternicode/bootstrap-datepicker/master/css/datepicker.css">
</head>
<body>
<?php
function display_dynamic_pricing_table(){
global $post;
# see line 42 of woocommerce_pricing_by_product.class.php
$pricing_rule_sets = get_option('_a_category_pricing_rules', array());
$found = false;
if(count($pricing_rule_sets)){
global $woocommerce_pricing;
foreach ($pricing_rule_sets as $pricing_rule_set) {
<?php
date_default_timezone_set('Europe/London'); // Set this to your local timezone - http://www.php.net/manual/en/timezones.php
/**
* The root directory where the repos live.
*
* @var string
*/
$root_dir = '/your/root/dir/';
<?php
//a simple script to check user agents to detemine device type and or redirect
//==============================================
//get userangent string
$userAgentraw = $_SERVER['HTTP_USER_AGENT'];
//convert to lowercase to make search strings simplier
$userAgent = strtolower ( $userAgentraw );
@albertpak
albertpak / fallback_local_CDN.js
Created January 8, 2014 22:44
YepNope http://yepnopejs.com/ Modernizr http://modernizr.com/ If you are using Modernizr and/or Yepnope, you can use this method to load your favorite library from the CDN and fall-back to your local version if the initial load fails. Src: https://coderwall.com/p/pmx_4w
//Load
yepnope([
{
load: [
'//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',
'//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js',
'//cdnjs.cloudflare.com/ajax/libs/raphael/1.5.2/raphael-min.js'
],
complete: function(){