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
| const { GraphQLServer } = require('graphql-yoga') | |
| const mongoose = require('mongoose') | |
| require('dotenv').config() | |
| const resolvers = require('./resolvers') | |
| mongoose.connect(process.env.MONGODB_URI) | |
| const db = mongoose.connection | |
| db.on("error", console.error.bind(console, "connection error")) | |
| db.once("open", function(callback){ | |
| console.log("Connection Succeeded") |
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
| function magnitude(vx, vy) { | |
| return Math.sqrt(vx**2 + vy**2) | |
| } | |
| function slope(x1, y1, x2, y2) { | |
| return (y2 - y1) / (x2 - x1) | |
| } | |
| function isParallel(l1, l2) { | |
| const [[x1,y1],[x2,y2]] = l1 |
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
| """ | |
| REINFORCE with Baseline | |
| """ | |
| import collections | |
| import gym | |
| import numpy as np | |
| import tensorflow as tf | |
| from keras.models import Model |
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
| """ | |
| REINFORCE(Policy Gradient) | |
| """ | |
| import collections | |
| import gym | |
| import numpy as np | |
| import tensorflow as tf | |
| from keras.models import Model |
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 numpy as np | |
| from sklearn.model_selection import train_test_split | |
| import torch | |
| import torch.nn as nn | |
| from torch.autograd import Variable | |
| np.random.seed(1337) | |
| MAX_LEN = 30 |
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
| from urllib import request | |
| from lxml import etree | |
| import re | |
| def get_index(e): | |
| tag = e.tag | |
| prev_list = [i for i in e.itersiblings(preceding=True) if i.tag == tag] | |
| next_list = [i for i in e.itersiblings() if i.tag == tag] | |
| if len(prev_list + next_list) == 0: | |
| return None |
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
| yamanote = ["大崎","五反田","目黒","恵比寿","渋谷","原宿","代々木","新宿","新大久保","高田馬場","目白","池袋","大塚","巣鴨","駒込","田端","西日暮里","日暮里","鶯谷","上野","御徒町","秋葉原","神田","東京","有楽町","新橋","浜松町","田町","品川"] | |
| class ArrayIterator | |
| def initialize(array) | |
| @array = array | |
| @index = 0 | |
| end | |
| def item |
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
| #week3/plactice/app/jobs/pokemon/pokemon_job.rb | |
| module Pokemon | |
| class PokemonJob < ApplicationJob | |
| queue_as :default | |
| def perform(*args) | |
| puts "ポケモンGO!" | |
| end | |
| end | |
| end |
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
| require "redis" | |
| redis = Redis.new | |
| redis.zadd "date:2016-8-5", 214, 1 | |
| redis.zadd "date:2016-8-5", 252, 2 | |
| redis.zadd "date:2016-8-5", 5222, 3 | |
| redis.zadd "date:2016-8-5", 2231, 4 | |
| redis.zadd "date:2016-8-5", 442, 5 |
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
| require 'rails_helper' | |
| RSpec.describe "the signin process", :type => :feature do | |
| # before :each do | |
| # User.new(:email => '[email protected]', :password => 'password') | |
| # end | |
| it "signs me in" do | |
| visit '/login' | |
| within(".row") do |
NewerOlder