const ProjectActions = Enum({
CLEAR: 0,
SELECT: 1,
HOVER: 1,
RENAME: 2,
This file contains hidden or 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 React from 'react'; | |
import css from 'blahcss'; | |
const BlahSFC = ({ title }) => css(( | |
<div> | |
<header> | |
<h1>{title}</h1> | |
<p>some text in the header</p> | |
</header> |
This file contains hidden or 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 assert from 'assert'; | |
import { MongoClient as mongoClient } from 'mongodb'; | |
import thenAlways from './then-always'; | |
/** | |
* Use thenAlways to make a helper to safely initialize, use, and clean up a mongodb connection | |
* @param {string} dbURI The mongodb test database to connect to | |
* @param {func} doStuff A callback to run some tasks with the test database | |
* @returns {Promise} A promise resolving or rejecting when everything's done | |
*/ |
This file contains hidden or 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
interface Matchable { | |
name: string; | |
data: any[]; | |
match: (options: ProjectActionMatcher) => any; | |
} | |
interface MatcherCatchAll { | |
_: (...args: any[]) => any; | |
} |
This file contains hidden or 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
my_list = [0, 1, 2, 3, 4, 5, 6] | |
# if it's a very simple transformation, you can inline the function with `lambda` | |
squared = map(lambda el: el**2, my_list) | |
# squared should now be the list with all elements squared | |
assert squared == [0, 1, 4, 9, 16, 25, 36] # passes, woo! | |
This file contains hidden or 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
@app.route('/') | |
def home(): | |
return "hello world" | |
### OR ### | |
def home(): | |
return "hello world" | |
app.route('/')(home) |
This file contains hidden or 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
/** | |
* An example store to document sane conventions. | |
* | |
* Stores should implement these five methods at minimum. | |
* Additional methods (eg., event handlers) may be added. | |
* Never write directly to `this.data`, except in `init` | |
* and `setData`. | |
* | |
* A few methods are allowed to be called by external |
This file contains hidden or 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
impl Drop for PortMidi { | |
fn drop(&mut self) { | |
match portmidi::terminate() { | |
Err(why) => panic!(why), | |
Ok(_) => {/* nothing to do here */} | |
} | |
} | |
} |
I have a public key whose fingerprint is BE83 68DF 6C48 11C0 385C 8590 B02D 3B27 D870 6A99