Official Gov UK postcode regular expression:
^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([AZa-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$
| 'use strict'; | |
| // declare app-level module | |
| var app = angular.module('app', []); | |
| // register directive | |
| app.directive('partial', function () { | |
| return { | |
| templateUrl: "partial.html", // url to template | |
| restrict: "AE" // restrict directive trigger to attribute (A) and element (E), not classname (C) |
| $ npm config set prefix ~/npm | |
| $ echo prefix = ~/.node >> ~/.npmrc | |
| # append this to .bashrc or .bash_profile: export PATH="$PATH:$HOME/.node/bin" |
Official Gov UK postcode regular expression:
^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([AZa-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$
| x = if a then (if b then 1 else 0) else 0 | |
| # a and b => x is 1 | |
| # a and !b => x is 0 | |
| # !a => x is 0 |
| # Include Crypto JS modules as required | |
| CryptoJS = require 'crypto-js' | |
| AES = require 'crypto-js/aes' | |
| # then use like so: | |
| str = "Message to encrpyt" | |
| passcode = "wu gang chops the tree" | |
| hash = AES.encrypt(str, passcode).ciphertext.toString(CryptoJS.enc.Base64) # => hI524rbTeezmKq9BSl1b0ZOtgGAu+4y8X4FAk/VAMh8= |
To escape double-stashes (as seen in Mustache, Handelbars templates etc) within Liquid/Pygments highlight blocks:
You've got to put this {{ " directly before the opening double-stashes and this " }} directly before the closing double-stashes.
So say you're trying to highlight something like this:
<template attr='{{ value }}'>
<li>{{ this }}</li>
| request = new XMLHttpRequest(); | |
| request.open('GET', '/data/data.json', true); | |
| request.onload = function() { | |
| if (this.status >= 200 && this.status < 400){ | |
| data = JSON.parse(this.response); | |
| console.log(data); | |
| } else { | |
| console.log("Data error"); | |
| } |
| <html> | |
| <head> | |
| <!-- Link to import file --> | |
| <link rel="import" href="template.html" name="template1"> | |
| </head> | |
| <body> | |
| <!-- a container div with an id to match the name attribute of the import link --> | |
| <div class="container" id="template1"> | |
| <!-- the contents of template.html will be inserted here at runtime --> |
| $ mkdir newdir && cd $_ |
| <?php | |
| header('Content-Type: application/json'); | |
| function scan(){ | |
| $dirOne = scandir('../data/one'); | |
| $dirTwo = scandir('../data/two'); | |
| $response = (object) array('dirOne' => $dirOne, 'dirTwo' => $dirTwo); |