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
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > | |
| <title>xhr2 test</title> | |
| <body> | |
| <input type="text" id="input"/> | |
| <button id="send">send</button> | |
| <script> | |
| var inputEL = document.getElementById('input'); | |
| document.getElementById('send').addEventListener('click', function(e) { |
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
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > | |
| <title>xhr2 test</title> | |
| <body> | |
| <div> | |
| <h3>インプット</h3> | |
| <p>整数:<input type="text" id="input"/>例:"0x1, 0x3, 0x4"</p> | |
| <p>文字列:<input type="text" id="text-input"/>例: "hello, world"</p> | |
| <button id="send">send</button> |
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
| #path: project_name//app/controllers/home_controllers.rb | |
| class HomeController < ActionController::Base | |
| def index | |
| end | |
| def update | |
| @params = params | |
| render '/home/params' | |
| 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
| #!/usr/bin/env python2.7 | |
| import unittest | |
| from test import test_support | |
| class TestClass(unittest.TestCase): | |
| def test_answer_conserves_names(self): | |
| self.assertEqual(len(getNames("nick.txt", True)), | |
| len(getNames("answer.txt"))) | |
| def test_answer_nameList_is_uniq(self): | |
| self.assertTrue(isUniq(getNames("answer.txt"))) | |
| def isUniq(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
| class Counter: | |
| fmt = "%d, %d" | |
| def __init__(self): | |
| self.db = {} | |
| def count(self, w, h): | |
| n = 0 | |
| assert(w < h) | |
| n = self.db.get(Counter.fmt % (w, h), None) | |
| if n: return n | |
| if h % w == 0: |
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 shell_sort(a): | |
| size = len(a) | |
| h = 1 | |
| while True: | |
| h = 3 * h + 1 | |
| if h > size: break | |
| while True: | |
| h /= 3 | |
| #print "h=%d" % h | |
| for i in range(h, size): |
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 java.lang.reflect.Field; | |
| public class MemoryCheck { | |
| private static int OVERHEAD = 16; | |
| public static int calcUsage(Class testClass) throws Exception { | |
| int usage = OVERHEAD; | |
| Object obj = testClass.newInstance(); | |
| for (Field field : testClass.getDeclaredFields()) { | |
| String fieldName = field.getName(); | |
| String fieldType = field.getType().getSimpleName(); | |
| if (fieldType.equals("boolean")) |
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
| # test/fixtures/bodies.yml | |
| one: | |
| id: 1 | |
| file_entry_id: 1 | |
| description: desc1 | |
| two: | |
| id: 2 | |
| file_entry_id: 3 | |
| description: description2 |
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
| eval :: String -> Int | |
| eval xs = case (parse expr xs) of | |
| Just (n, "") -> n | |
| Just (_, out) -> error ("unused input " ++ out) | |
| failure -> error "invalid input" |
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 System.Console.ANSI | |
| > | |
| > cls :: IO () | |
| > -- cls = putStr "\ESC[2J" | |
| > cls = clearScreen | |
| > | |
| > type Pos = (Int,Int) | |
| > | |
| > goto :: Pos -> IO () | |
| > --goto (x,y) = putStr ("\ESC[" ++ show y ++ ";" ++ show x ++ "H") |