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
app.run(function($rootScope, $location) { | |
$rootScope.$on( "$routeChangeStart", function(event, next, current) { | |
if ($rootScope.loggedInUser == null) { | |
// no logged user, redirect to /login | |
if ( next.templateUrl === "partials/login.html") { | |
} else { | |
$location.path("/login"); | |
} | |
} | |
}); |
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
add_action( 'woocommerce_before_cart', 'apply_matched_coupons' ); | |
function apply_matched_coupons() { | |
global $woocommerce; | |
$coupon_code = '10percent'; // your coupon code here | |
if ( $woocommerce->cart->has_discount( $coupon_code ) ) return; | |
if ( $woocommerce->cart->cart_contents_total >= 500 ) { |
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
public function getActualLength($string){ | |
$charArray = str_split($string); | |
$output = array(); | |
foreach ($charArray as $char){ | |
if (isset($char) && !empty($char) && $char != '' && ord($char) != 14) $output[] = $char; | |
} | |
return count($output); | |
} |
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
$spreadsheet_url="https://docs.google.com/spreadsheet/pub?key=<somecode>&single=true&gid=0&output=csv"; | |
if(!ini_set('default_socket_timeout', 15)) echo "<!-- unable to change socket timeout -->"; | |
if (($handle = fopen($spreadsheet_url, "r")) !== FALSE) { | |
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { | |
$spreadsheet_data[]=$data; | |
} | |
} | |
fclose($handle); |
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
function convert_number_to_words($number) { | |
$hyphen = '-'; | |
$conjunction = ' and '; | |
$separator = ', '; | |
$negative = 'negative '; | |
$decimal = ' point '; | |
$dictionary = array( | |
0 => 'zero', | |
1 => 'one', |
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> | |
<head> | |
<meta charset="UTF-8"> | |
<title>TypeWriter</title> | |
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script> | |
</head> | |
<body ng-controller="TypeWriterController"> | |
<textarea ng-model="type" ng-model="cursor">{{type}}</textarea> |
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> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Lines</title> | |
<script type="text/javascript" src="js/vendor/paper.js"></script> | |
<script type="text/javascript" src="js/vendor/angular.min.js"></script> | |
</head> | |
<body ng-controller="PaperController"> | |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
autoprefixer: { | |
options: { |
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
.content | |
{ | |
width: 80%; /* 960 */ | |
width: -webkit-calc( 100% - 15em ); /* 240 */ | |
width: -moz-calc( 100% - 15em ); /* 240 */ | |
width: calc( 100% - 15em ); /* 240 */ | |
float: left; | |
} | |
.sidebar | |
{ |
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
<script> | |
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' ); | |
</script> |