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
Plugboard = Hash[*('A'..'Z').to_a.sample(20)] | |
Plugboard.merge!(Plugboard.invert) | |
Plugboard.default_proc = proc { |_, key| key } | |
def build_a_rotor | |
Hash[('A'..'Z').zip(('A'..'Z').to_a.shuffle)] | |
end | |
ROTOR_1, ROTOR_2, ROTOR_3 = build_a_rotor, build_a_rotor, build_a_rotor |
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
query IntrospectionQueryTypeQuery { | |
__schema { | |
queryType { | |
name | |
fields { | |
name | |
description | |
type { | |
name | |
kind |
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
query IntrospectionMovieNestedFieldsQuery { | |
__type(name: "Movie") { | |
name | |
description | |
fields { | |
name | |
description | |
type { | |
name | |
kind |
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
query IntrospectionImdbNestedFieldsQuery { | |
__type(name: "Imdb") { | |
name | |
description | |
fields { | |
name | |
description | |
type { | |
name | |
kind |
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
query FetchInceptionQuery { | |
movie(title: "Inception") { | |
title | |
director | |
actors | |
released | |
type | |
plot | |
poster | |
director |
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 Post from './Post'; | |
class App extends React.Component { | |
render() { | |
return ( | |
<div> | |
<h1>Post list</h1> | |
<ul> | |
{this.props.posts.edges.map(edge => | |
<Post key={edge.node.id} post={edge.node} /> |
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 PostIndex extends React.Component { | |
state = { loading: false }; | |
componentDidMount() { | |
window.onscroll = () => { | |
if (!this.state.loading | |
&& (window.innerHeight + window.scrollY) | |
>= document.body.offsetHeight) { | |
this.setState({loading: 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
# precomile the static assets the HTML pages link to such as the .js, .css and .jpg files | |
RAILS_ENV=production bundle exec rake assets:precompile | |
# circleci has RAILS_ENV & RACK_ENV env variables set to test need to override. -d runs | |
# the server as a daemon. | |
RAILS_ENV=production RACK_ENV=production bundle exec rails s -d | |
# wait for server to load | |
sleep 10 |
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
machine: | |
ruby: | |
version: 2.2.3 | |
dependencies: | |
pre: | |
- sudo pip install awscli | |
# gets verion 1.15 instead of 1.13.4 | |
- sudo apt-get update; sudo apt-get install wget |
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
# delete flag means files that exist in the prod bucket but not in the staging | |
# bucket are deleted during sync | |
aws s3 sync s3://staging.mybucket.com s3://mybucket.com --delete --region eu-west-1 |
OlderNewer