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
# 1 | |
def new_cat(str1, str2) | |
str1 + str2 | |
end | |
new_cat("Ken ", "Shimizu") | |
# 2 | |
def sum(nums_to_add) | |
nums_to_add.inject(0, :+) |
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
# nginx | |
description "nginx http daemon" | |
author "George Shammas " | |
start on (filesystem and net-device-up IFACE=lo) | |
stop on runlevel [!2345] | |
env DAEMON=/usr/sbin/nginx | |
env PID=/var/run/nginx.pid |
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
function listWrapper(ListComponent) { | |
const ListWrapper = React.createClass({ | |
getInitialState() { | |
return { | |
selection: new Set(), | |
}; | |
}, | |
handleOnSelect(item) { | |
if(this.state.selection.has(item)) { |
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
var UserList = React.createClass({ | |
getInitialState() { | |
return { | |
users: [], | |
selection: new Set(), | |
}; | |
}, | |
fetchUsers() { | |
// Hit API, get users, and set to users on state. |
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
var PokemonList = React.createClass({ | |
getInitialState() { | |
return { | |
pokemon: [], | |
selection: new Set(), | |
}; | |
}, | |
fetchPokemon() { | |
// Hit API, get pokemon, and set to pokemon on state. |
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
var UserList = React.createClass({ | |
propTypes: { | |
onSelect: React.PropTypes.func.isRequired, | |
selection: React.PropTypes.object.isRequired, | |
}, | |
getInitialState() { | |
return { | |
users: [], | |
}; |
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
var PokemonList = React.createClass({ | |
propTypes: { | |
onSelect: React.PropTypes.func.isRequired, | |
selection: React.PropTypes.object.isRequired, | |
}, | |
getInitialState() { | |
return { | |
pokemon: [], | |
}; |
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 React from 'react'; | |
import UserList from 'user_list'; | |
import PokemonList from 'pokemon_list'; | |
$(function() { | |
function render() { | |
var userList = $('#user-list'), | |
pokemonList = $('#pokemon-list'); | |
if (userList.length > 0) { |
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 React from 'react'; | |
import UserList from 'user_list'; | |
import PokemonList from 'pokemon_list'; | |
import listWrapper from 'list_wrapper'; | |
$(function() { | |
function renderList(ListComponent, $domNode) { | |
var List = listWrapper(ListComponent); | |
ReactDOM.render(<List />, $domNode[0]); |
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 React from 'react'; | |
import "babel-polyfill"; | |
import listWrapper from 'list_wrapper'; | |
import { shallow } from 'enzyme'; | |
describe('ListWrapper', function () { | |
var wrapper, ListComponent, MockListComponent, instance, set; | |
beforeEach(function () { | |
MockListComponent = React.createClass({ |
OlderNewer