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
// Modified from http://redotheweb.com/2013/05/15/client-side-full-text-search-in-css.html | |
// you'll need to add type='text/css' to the style tag in the HTML for this to work in IE<9 | |
(function() { | |
var addslashes = function(str) { | |
return (str + '') | |
.replace(/[\\"']/g, '\\$&') | |
.replace(/\u0000/g, '\\0'); | |
}; |
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
<!DOCTYPE html> | |
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Breakpoint detection test</title> | |
<style type="text/css" media="screen"> | |
@media screen and (min-width: 320px) { | |
#page:after { | |
content: 'smallest'; /* represent the current width-bracket */ |
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
module curved_triangle(r, pitch, separation, gap) { | |
assign(num_steps = 36) | |
assign(top_d = pitch - 2 * separation) | |
assign(bottom_d = triangle_tip_width) | |
assign(delta = top_d - bottom_d) | |
assign(d_incr = delta / (num_steps-1)) | |
assign(b_incr=116/(num_steps - 1)) | |
render() | |
for (i=[0:(num_steps-2)]) { | |
hull() { |
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
// Pin for the LED | |
int LEDPin = GREEN_LED; | |
int speakerPin = P1_1; | |
// Pin to connect to your drawing | |
int button1N = 4; | |
int button2N = 5; | |
// This is how high the sensor needs to read in order | |
// to trigger a touch. You'll find this number | |
// by trial and error, or you could take readings at |
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 saveAs(arrayBuffer, fileName, mime) { | |
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; | |
window.requestFileSystem(window.TEMPORARY, arrayBuffer.byteLength, function(fs) { | |
fs.root.getFile(fileName, {create: true}, function(fileEntry) { | |
fileEntry.createWriter(function(writer) { | |
var dataView = new DataView(arrayBuffer); | |
var blob = new Blob([dataView], {type: 'font/opentype'}); | |
writer.write(blob); | |
writer.addEventListener('writeend', function() { |
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
ngOnInit() { | |
this.filteredRoutes$ = from(this.routes).pipe( | |
concatMap((route) => { | |
// handle if nothing is in canActivate | |
if (!route.canActivate || !route.canActivate.length) { | |
// create an object that has the route and result for filtering | |
return of({ route, result: true }); | |
} | |
return from(route.canActivate).pipe( |
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
const RE_YEAR = re`(?<year>[0-9]{4})`; | |
const RE_MONTH = re`(?<month>[0-9]{2})`; | |
const RE_DAY = re`(?<day>[0-9]{2})`; | |
const RE_DATE = re`${RE_YEAR}-${RE_MONTH}-${RE_DAY}`; | |
const matchObj = RE_DATE.exec('1999-12-31'); | |
const year = matchObj.groups.year; // 1999 | |
const month = matchObj.groups.month; // 12 | |
const day = matchObj.groups.day; // 31 |
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
// Lazy Getters | |
/* What enables Tail Recursion Modulo Cons in Javascript is a thunk in Weak Head Normal Form. | |
An expression in weak head normal form has been evaluated to the outermost data constructor, | |
but contains sub-expressions that may not have been fully evaluated. In Javascript only thunks | |
can prevent sub-expressions from being immediately evaluated. */ | |
const cons = (head, tail) => ({head, tail}); | |
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
import { Observable } from 'rxjs/Observable'; | |
/** | |
* Creates an observable that emits samples from an easing function on every animation frame | |
* for a duration `d` ms. | |
* | |
* The first emitted value will be a sample form the easing function at `t = 0`, | |
* and the last emitted value is guaranteed to be the easing function at `t = d`. | |
* | |
* It can be used with any of [Robert Penner's easing functions](http://robertpenner.com/easing/), |