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
class DartLexer(RegexLexer): | |
""" | |
For `Dart <http://dartlang.org/>`_ source code. | |
""" | |
name = 'Dart' | |
aliases = ['dart'] | |
filenames = ['*.dart'] | |
mimetypes = ['text/x-dart'] |
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 * as React from "react"; | |
import { nextTick } from "../std/nexttick"; | |
import { updated } from "../std/fridge"; | |
import { shallowObjectEquals } from "../std/u"; | |
const uniqueObject = {}; | |
export class StatefulComponent<T, U> extends React.Component<T> { | |
protected readonly data: U; | |
private allowRender: boolean = true; |
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 { Router } from 'react-router'; | |
import { Match } from "./matchchildren" | |
const App = () => ( | |
<Router> | |
<Match pattern="/"><Hello name="Yoyoma"/></Match> | |
</Router> | |
) | |
const Hello = (props) => { |
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
// Run this example locally by copy/pasting it into | |
// `src/App.js` of an app created with `create-react-app` | |
// https://github.com/facebookincubator/create-react-app | |
import React from 'react' | |
import Match from 'react-router/Match' | |
import Miss from 'react-router/Miss' | |
import Link from 'react-router/Link' | |
import Redirect from 'react-router/Redirect' | |
import Router from 'react-router/BrowserRouter' |
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
// You don't want to serve HTTPS supporting for SSL3.0 any longer, see: | |
// http://googleonlinesecurity.blogspot.de/2014/10/this-poodle-bites-exploiting-ssl-30.html | |
import ( | |
"crypto/tls" | |
"net/http" | |
) | |
// This code supports SSL3.0, TLS1.0, TLS1.1 and TLS1.2 | |
// Chances are you currently do this but want to stop due to the POODLE | |
err := http.ListenAndServeTLS(addr, "crtfile", "keyfile", handler) |
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
Hello there, | |
I'm supporting DELETED and DELETED with IT. Both of them are paying customers of yours. I was pretty shocked when I learned today that when you encounter a path longer than 260 characters (on a Windows system), you do no sync it, and you do not inform the end user about it. In a shared folder setup, this is pretty disastrous. | |
I can think of two sensible ways to handle the limitation of 260 character long paths in Windows. | |
1. Detect them, and inform the user prominently that he/she has files that will not be synced. | |
2. Detect and sync as usual (this is certainly possible from a technical standpoint). | |
Your current way of handling this causes lots of frustration to end-users and at the end of the day, may cause them to lose data quite easily. |
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
#include <stdio.h> | |
#include <sys/types.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <time.h> | |
#include <string.h> | |
#include <sys/time.h> | |
long long gettime_ms(void) | |
{ |
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
// according to my guesses of what is to come in future ES6 specs: | |
// the loop should execute five times so the program should print five numbers at the end | |
// the fresh-per-iteration x is captured in a closure (that will increment it by 3), | |
// then executed (for side-effects only) in the cond-expr and post-expr. | |
// it will never ever modify the outer x thus five loop iterations | |
(function() { | |
let arr = []; | |
let fn = null; | |
let cnt = 0; | |
for (let x = 0; (fn && fn()), x < 5; (fn && fn()), x++) { |
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
// will this example | |
let arr = []; | |
for (let x = 0; x < 5; x++) { | |
x++; | |
arr.push(function() { return x; }); | |
} | |
// ..be semantically equivalent to this? | |
let arr = []; |
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
Lot's of good stuff from Ariya as always and expected! :) I wanted to chime in with a couple of comments regarding ES6 block scope, const in particular. It's kind of a pet-peeve of mine (I'm the author of the defs transpiler). | |
The article describes Mozilla-JS const, not ES6 const. Mozilla-JS const is not block scoped and is silent on reassignment. ES6 const is block scoped and reassignment is a static error found at parse time (see https://gist.github.com/olov/6255863) before program execution. Do note that you have to opt-in to using ES6 const in v8/node via strict mode, otherwise you'll get Mozilla-const semantics. Prepend a "use strict"; to the example and re-run it - *boom* you're now in the beautiful world of ES6 const. :) | |
Also, while not an error, my humble opinion is that we're missing out big time by teaching that "the major use case for const is to safeguard important constants". While that may have been true in a Mozilla-JS const world, in ES6 const means that the variable binding won't change - a |
NewerOlder