(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| // sync example. | |
| function createSlug(title) { | |
| return title | |
| .toLowerCase() | |
| .replace(/[^\w ]+/g,'') | |
| .replace(/ +/g,'-'); | |
| } | |
| var slug = createSlug('This is a test!'); | |
| console.log(slug); |
| @import "compass/css3/shared"; | |
| // NOTE: | |
| // All mixins for the 2009 spec have been written assuming they'll be fed property values that | |
| // correspond to the standard spec. Some mixins can be fed values from the 2009 spec, but don't | |
| // rely on it. The `legacy-order` mixin will increment the value fed to it because the 2009 | |
| // `box-ordinal-group` property begins indexing at 1, while the modern `order` property begins | |
| // indexing at 0. | |
| // if `true`, the 2009 properties will be emitted as part of the normal mixin call |
| ### Nginx upstart script | |
| ### source: http://serverfault.com/a/391737/70451 | |
| ### /etc/init/nginx.conf | |
| description "nginx http daemon" | |
| start on (filesystem and net-device-up IFACE=lo) | |
| stop on runlevel [!2345] | |
| env DAEMON=/usr/local/sbin/nginx |
| function elementInViewport(el) { | |
| var rect = el.getBoundingClientRect() | |
| return rect.top < (window.innerHeight || document.body.clientHeight) && rect.left < (window.innerWidth || document.body.clientWidth); | |
| } | |
| // and then you can use it: | |
| alert(elementInViewport(document.getElementById('inner'))); | |
| // or | |
| alert(elementInViewport($('#inner')[0])); | |
| ` |
| // Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
| // Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
| var FORMAT_ONELINE = 'One-line'; | |
| var FORMAT_MULTILINE = 'Multi-line'; | |
| var FORMAT_PRETTY = 'Pretty'; | |
| var LANGUAGE_JS = 'JavaScript'; | |
| var LANGUAGE_PYTHON = 'Python'; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Canvas Hexagonal Map</title> | |
| <style type="text/css"> | |
| canvas { | |
| border:0; | |
| display:block; | |
| margin:0 auto; |
| /* | |
| Copyright 2011 Martin Hawksey | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |
| // Generates a URL-friendly "slug" from a provided string. | |
| // For example: "This Is Great!!!" transforms into "this-is-great" | |
| function generateSlug (value) { | |
| // 1) convert to lowercase | |
| // 2) remove dashes and pluses | |
| // 3) replace spaces with dashes | |
| // 4) remove everything but alphanumeric characters and dashes | |
| return value.toLowerCase().replace(/-+/g, '').replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, ''); | |
| }; |