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
var TodoList = React.createClass({ | |
... | |
shouldComponentUpdate: function( nextProps ){ | |
return nextProps.todos != this.props.todos; | |
} | |
... | |
}); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<link href='http://fonts.googleapis.com/css?family=Bree+Serif|Open+Sans+Condensed:700,300,300italic' rel='stylesheet' type='text/css'> | |
<link rel="stylesheet" type="text/css" href="css/style2.css" /> | |
</head> | |
<body> | |
<section class="rw-wrapper"> |
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
.rw-words{ | |
display: inline; | |
text-indent: 10px; | |
text-align: left; | |
} | |
.rw-words span{ | |
position: absolute; | |
opacity: 0; | |
overflow: hidden; |
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 static void Send(Socket socket, byte[] buffer, int offset, int size, int timeout) | |
{ | |
int startTickCount = Environment.TickCount; | |
int sent = 0; // how many bytes is already sent | |
do { | |
if (Environment.TickCount > startTickCount + timeout) | |
throw new Exception("Timeout."); | |
try { | |
sent += socket.Send(buffer, offset + sent, size - sent, SocketFlags.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
Socket socket = tcpClient.Client; | |
string str = "Hello world!"; | |
try | |
{ // sends the text with timeout 10s | |
MyClass.Send(socket, Encoding.UTF8.GetBytes(str), 0, str.Length, 10000); | |
} | |
catch (Exception ex) { /* ... */ } |
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 static void Receive(Socket socket, byte[] buffer, int offset, int size, int timeout) | |
{ | |
int startTickCount = Environment.TickCount; | |
int received = 0; // how many bytes is already received | |
do { | |
if (Environment.TickCount > startTickCount + timeout) | |
throw new Exception("Timeout."); | |
try { | |
received += socket.Receive(buffer, offset + received, size - received, SocketFlags.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
Socket socket = tcpClient.Client; | |
byte[] buffer = new byte[12]; // length of the text "Hello world!" | |
try | |
{ // receive data with timeout 10s | |
MyClass.Receive(socket, buffer, 0, buffer.Length, 10000); | |
string str = Encoding.UTF8.GetString(buffer, 0, buffer.Length); | |
} | |
catch (Exception ex) { /* ... */ } |
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
.inputfile + label { | |
font-size: 1.25em; | |
font-weight: 700; | |
color: white; | |
background-color: black; | |
display: inline-block; | |
} | |
.inputfile:focus + label, | |
.inputfile + label:hover { |
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
.inputfile { | |
width: 0.1px; | |
height: 0.1px; | |
opacity: 0; | |
overflow: hidden; | |
position: absolute; | |
z-index: -1; | |
} |
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
.inputfile + label { | |
cursor: pointer; /* "hand" cursor */ | |
} |