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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
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
app.directive('ngEnter', function() { | |
return function(scope, element, attrs) { | |
element.bind("keydown keypress", function(event) { | |
if(event.which === 13) { | |
scope.$apply(function(){ | |
scope.$eval(attrs.ngEnter); | |
}); | |
event.preventDefault(); | |
} |
// === Arrays | |
var [a, b] = [1, 2]; | |
console.log(a, b); | |
//=> 1 2 | |
// Use from functions, only select from pattern | |
var foo = () => [1, 2, 3]; |
// NOTE: the '#form-id' selector below will most certainly be different | |
// for whatever page you're on. Remember to change it in both instances! | |
// run this in the terminal to save the state of your form | |
// in your browser's LocalStorage: | |
[].forEach.call(document.querySelector('#form-id').elements, function(el) { | |
localStorage.setItem(el.name, el.value); | |
}); | |
// then refresh the page and run this to restore your form values: |
Earlier this year Facebook open sourced its React based rich text editing framework Draft.js. At Facebook it powers status updates, comments & notes. Others used it to build editors matching Medium’s experience.
Together with a whole team of open source contributors I built a plugin architecture on top of Draft.js. In this talk I walk you through the existing plugins and show how you can build your own feature-rich text editor for the web with only a handful lines of code. 🤓
let start = Date() | |
print("Elapsed time: \(start.timeIntervalSinceNow) seconds") |
import AppKit | |
import ScriptingBridge | |
@objc public protocol SBObjectProtocol: NSObjectProtocol { | |
func get() -> Any! | |
} | |
@objc public protocol SBApplicationProtocol: SBObjectProtocol { | |
func activate() | |
var delegate: SBApplicationDelegate! { get set } |
'#ff2233'.substr(1).match(/.{2}/g).reverse().join('') |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
... | |
// Express 4.0 | |
app.use(bodyParser.json({ limit: '10mb' })); | |
app.use(bodyParser.urlencoded({ extended: true, limit: '10mb' })); | |
// Express 3.0 |