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 { BehaviorSubject, Observable } from 'rxjs'; | |
/** | |
* Observes the specified property and returns a stream that emits all values which are assigned to the property. When subscribing to the | |
* resulting stream it will always first emit the current value of the property, followed by all new values that are assigned to it. | |
* | |
* @param target Object containing the property. | |
* @param key Key of the property that is to be observed. | |
* @returns A stream of all values that are assigned to the specified property, starting with the current value of the property. | |
*/ |
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 Component from 'react-pure-render/component'; | |
import React, {PropTypes} from 'react'; | |
import {Link} from 'react-router'; | |
export default class Header extends Component { | |
static propTypes = { | |
msg: PropTypes.object.isRequired, | |
pathname: PropTypes.string.isRequired, | |
viewer: PropTypes.object |
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
var bookshelf = require('./bookshelf'); | |
var Post = require('./post'); | |
/* | |
Schema: | |
posts: | |
id: PRIMARY | |
title: VARCHAR |
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
,,,,,,,,,,,,,,,.,.....................................................................................................................`````````````````````````````````````````````````````````````````` | |
,,,,,,,,,,,,,,,,,,,.,.,,,.,,...........................................................................................................````````````````````````````````````````````````````````````````` | |
,,,,,,..,,,,,,,,,,,,,,.,,,.............................................................................................................````````````````````````````````````````````````````````````````` | |
,,,,,,...,,,,,,,,,,,,,,................................................................................................................````````````````````````````````````````````````````````````````` | |
.,,,,....,,,,,,.,,,,,,,...............................................................................................................`````````````````````````````````````````````````````````````````` | |
..,......,,,,...... |
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
#include <SFML/Graphics.hpp> | |
// Map of sprite vectors, mapped by name | |
std::map<std::string, std::vector<sf::Sprite>> sprites; | |
sf::Texture texture; | |
// Create some sprite frames and map to a name | |
void defineSprite(const std::string& name, const std::vector<sf::IntRect>& frames) { | |
std::vector<sf::Sprite> namedFrames(frames.size()); |
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
// ----------------- | |
// scripts/breeds.json (This is okay, I've used it in another context and its interpreted correctly) | |
// ----------------- | |
{ | |
"Warrior": { | |
"sheet": "resources/Fighter-F-01.png", | |
"stats": { | |
"health": 100, | |
"strength": 50, | |
"intelligence": 10 |
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
class SpriteSheet | |
{ | |
public: | |
SpriteSheet(); | |
SpriteSheet(const std::string& filename); | |
void defineSprite(std::string name, std::vector<sf::IntRect> frames); | |
const sf::Sprite& getFrame(const std::string& name, int frame); | |
sf::Texture texture; |
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
var menuItems = Immutable.List.of( | |
{ parent_id: 0, id: 1 }, | |
{ parent_id: 1, id: 2 }, | |
{ parent_id: 1, id: 2 } | |
); | |
var results1 = menuItems | |
.filter(function(menuItem) { return menuItem.parent_id === 1; }) // Filter out items with parent_id = 1 | |
.sort(function(childA, childB) { return childA.sort_order - childB.sort_order; }); // Sort them by sort_order |