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 sklearn import datasets | |
| import csv, math, random | |
| import pandas as pd | |
| import numpy as np | |
| from collections import defaultdict | |
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
| def customer_count(status, gender) | |
| Customer.where(status: status, gender: gender).size | |
| 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
| # Specify the provider and access details | |
| provider "aws" { | |
| region = "ap-northeast-1" | |
| } | |
| resource "aws_instance" "web" { | |
| ami = "ami-374db956" | |
| instance_type = "t2.micro" | |
| tags { | |
| Name = "NomadAgent" |
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 User, type: :model do | |
| describe ".is_gmail_user?" do | |
| context "given a gmail address" do | |
| it "returns true" do | |
| user1 = User.new({email: '[email protected]'}) | |
| expect(user1.is_gmail_user?).to eql(true) | |
| 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 '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 |
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
| #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
| 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
| 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
| 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 |
OlderNewer