Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
/* Justify inline block elements for a percentage grid without specifying margins: LESS mixin. See http://www.barrelny.com/blog/text-align-justify-and-rwd/ */ | |
.jgroup { | |
text-align: justify; | |
font-size: .01px; | |
&:after{ | |
content: ''; | |
display: inline-block; | |
width: 100%; |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Below is a collection of my favourite responses I gathered from Guardian engineers when asked the question: What have you learnt starting from scratch and building a mobile-first next generation web platform for the Guardian?
@angular.module('HelloApp', ['components']) | |
@angular.module('components', []) | |
.directive('testElem', -> | |
restrict: 'A' | |
template: '<div class="my-directive-class"><h1>Hello...</h1><p ng-repeat="obj in arr">{{obj}}</p></div>' | |
link: (scope, iterStartElement, attr) -> | |
$(".my-directive-class").css({ 'background-color': 'yellow'}) | |
scope.arr = ["Steve", 'is', 'the', 'beast'] | |
) |
App.debounce = (func, wait) -> | |
timeout = {} | |
-> | |
context = this | |
args = arguments | |
lastArg = args[args.length - 1] | |
immediate = true if lastArg and lastArg.now |
var toggleWatch = function(watchExpr, fn) { | |
var watchFn; | |
return function() { | |
if (watchFn) { | |
watchFn(); | |
watchFn = undefined; | |
console.log("Disabled " + watchExpr); | |
} else { | |
watchFn = $scope.$watch(watchExpr, fn); | |
console.log("Enabled " + watchExpr); |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<h2>Original CSS</h2> | |
<style style="display: block; white-space: pre; font-family: monospace"> | |
h2 { margin:0; } |
I've had to tackle the client validations problem in almost every Ember app I've ever written, and I've done it in a bunch of different ways. This is the way I ended up liking most. There are a few things that I really wanted to have in a validation framework:
<input type = "search" placeholder = "Search..." required x-webkit-speech name="filter_search" results = "10" autosave = "unique-auto-save-name"/> |
/* Pre-Define HTML5 Elements in IE */ | |
(function(){ var els = "source|address|article|aside|audio|canvas|command|datalist|details|dialog|figure|figcaption|footer|header|hgroup|keygen|mark|meter|menu|nav|picture|progress|ruby|section|time|video".split('|'); for(var i = 0; i < els.length; i++) { document.createElement(els[i]); } } )(); |