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
field = [ | |
[1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, ], | |
[1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, ], | |
[1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, ], | |
[0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, ], | |
[1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, ], | |
[1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, ], | |
] | |
count = 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
class Circle | |
def initialize(radius) | |
@radius = radius | |
end | |
def draw | |
unless @canvas | |
diameter = 2 * @radius | |
@canvas = Array.new(diameter + 1){ ' ' * (2 * (diameter + 1)) } | |
key_points.each do |kx, ky| |
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
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p385.tar.gz | |
tar -xvzf ruby-1.9.3-p385.tar.gz | |
cd ruby-1.9.3-p385/ | |
CFLAGS="-march=native -O2" ./configure --prefix=/usr/local | |
make | |
make install |
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
(ns listener | |
(:require [clojure.java.io :as io]) | |
(:import [java.net ServerSocket Socket]) | |
(:import [java.io InputStreamReader BufferedReader])) | |
(def settings {:client-port 5000}) | |
(defn get-reader [socket] | |
(BufferedReader. (InputStreamReader. (.getInputStream socket)))) |
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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
GEMFILE | |
system 'bundle' | |
end | |
require 'bundler' |
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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
GEMFILE | |
system 'bundle' | |
end | |
require 'bundler' |
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
$('.item_img').click(function(e) { | |
e.preventDefault(); | |
var product_id = $(this).attr('href').match(/\/(\d+)\.html/)[1] | |
$.post('/shop/item/shops', { | |
region_id: '***region***', | |
size: '***size***', | |
product_id: product_id, | |
}, function(data) { | |
console.log(product_id, data.length > 0); | |
}); |