Skip to content

Instantly share code, notes, and snippets.

View mushfiqweb's full-sized avatar

Mushfiqur Rahman mushfiqweb

View GitHub Profile
var TodoList = React.createClass({
...
shouldComponentUpdate: function( nextProps ){
return nextProps.todos != this.props.todos;
}
...
});
<!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">
.rw-words{
display: inline;
text-indent: 10px;
text-align: left;
}
.rw-words span{
position: absolute;
opacity: 0;
overflow: hidden;
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);
}
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) { /* ... */ }
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);
}
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) { /* ... */ }
.inputfile + label {
font-size: 1.25em;
font-weight: 700;
color: white;
background-color: black;
display: inline-block;
}
.inputfile:focus + label,
.inputfile + label:hover {
.inputfile {
width: 0.1px;
height: 0.1px;
opacity: 0;
overflow: hidden;
position: absolute;
z-index: -1;
}
.inputfile + label {
cursor: pointer; /* "hand" cursor */
}