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
!!!html5 | |
%html | |
%body | |
%form{:action => '.', :method => 'get'} | |
width | |
%input{:name => 'width', :value => @params['width']} | |
height | |
%input{:name => 'height', :value => @params['height']} | |
fineness | |
%input{:name => 'fineness', :value => @params['fineness']} |
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 Disp | |
{ | |
void display() { | |
System.out.println("No argument"); | |
} | |
void display(String s) { | |
System.out.println(s); | |
} | |
void display(String s, int n) { | |
System.out.println(s + ", " + n); |
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
public class ArgsCheck | |
{ | |
public static void main(String args[]) { | |
if(args.length != 1) { | |
System.err.println("Wrong arguments"); | |
return; | |
} | |
int number = Integer.parseInt(args[0]); | |
if(check(number)) { | |
System.out.println(number + " is OK!"); |
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
public class Letter | |
{ | |
public static void main(String args[]) { | |
char ch = args[0].charAt(0); | |
System.out.println("Input a letter[A-E] : " + ch); | |
switch(ch) { | |
case 'A': | |
System.out.println("Excellent"); | |
break; | |
case 'B': |
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
public class Area | |
{ | |
public static void main(String args[]) { | |
double width = Integer.parseInt(args[0]); | |
double height = Integer.parseInt(args[1]); | |
System.out.println("Input Width : " + width); | |
System.out.println("Input Height : " + height); | |
System.out.println("Triangle Area : " + width * height / 2.0); | |
System.out.println("Square Area : " + width * height); | |
System.out.println("Circle Area : " + width * width * 3.14); |
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
#include <iostream> | |
#include <memory> | |
#include <cctype> | |
#include <cassert> | |
#include "expr.h" | |
namespace { | |
expr::ptr read_number(std::istream &is); | |
expr::ptr read_factor(std::istream &is); |
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
// INSTRUCTIONS | |
`define PUSH 0 | |
`define DUP 1 | |
`define COPY 2 | |
`define SWAP 3 | |
`define POP 4 | |
`define SLIDE 5 | |
`define ADD 6 | |
`define SUB 7 | |
`define MUL 8 |
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
module memory(CLK, WR, addr, data); | |
// default parameters | |
parameter WORD = 32; | |
parameter LEN = 65535; | |
input CLK; | |
input WR; // 0:read 0:write | |
input [WORD-1:0]addr; | |
inout [WORD-1:0]data; |
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
#include <iostream> | |
#include <list> | |
#include <memory> | |
class hoge; | |
typedef std::shared_ptr<hoge> hoge_ptr; | |
class hoge | |
{ | |
public: | |
hoge(const int x):x_(x) |
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
let bufsize = 1024;; | |
let port = 80;; | |
let http_get sock = | |
let rec http_get' sock acc = | |
let buf = String.create bufsize in | |
if Unix.read sock buf 0 (String.length buf) = 0 then acc | |
else http_get' sock acc ^ buf | |
in http_get' sock "";; | |