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
try | |
{ | |
//read the first line HTTP command | |
String httpCmd = clientStreamReader.ReadLine(); | |
if (String.IsNullOrEmpty(httpCmd)) | |
{ | |
clientStreamReader.Close(); | |
clientStream.Close(); | |
return; | |
} |
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
/** | |
* ECMAScript 5 implementation of Python's range function. | |
* @see {@link http://docs.python.org/release/1.5.1p1/tut/range.html} | |
* @param {Number} start | |
* @param {Number} end | |
* @param {Number} step | |
* @return {Array} | |
*/ | |
Object.defineProperty(Array, "range", { | |
writable: false, configurable: false, enumerable: true, |
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
DateTime data; | |
DateTime.TryParse("10/01/2012", CultureInfo.GetCultureInfo("en-US").DateTimeFormat, DateTimeStyles.None ,out data); | |
Console.WriteLine(data.ToString("m")); |
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
public static string unescape(string code) | |
{ | |
var str = Regex.Replace(code, @"\+", "\x20"); | |
str = Regex.Replace(str, @"%([a-fA-F0-9][a-fA-F0-9])", new MatchEvaluator((mach) => { | |
var _tmp = mach.Groups[0].Value; | |
var _hexC = mach.Groups[1].Value; | |
var _hexV = int.Parse(_hexC, System.Globalization.NumberStyles.HexNumber); | |
return ((char)_hexV).ToString(); | |
})); |
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
(function(p, r, o, x, y, s){ | |
y = function(c){ | |
return (c < r ? '' : y(parseInt(c / r))) + ((c = c % r) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) | |
}; | |
if (!''.replace(/^/, String)) { | |
while (o--) { | |
s[y(o)] = x[o] || y(o) | |
} | |
x = [function(y){ | |
return s[y] |
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
USE [moveis] | |
GO | |
/****** Object: Trigger [dbo].[organiza_registro] Date: 09/27/2012 22:50:44 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
/* | |
Autor: Alexsandro Souza Pereira | |
Data: São Paulo/SP 26 de Agosto de 2004 | 03:50 da Matina |
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
<?php | |
//The actual implementation is just this file. Others are usage and tests. | |
class TodoList extends ArrayObject | |
{ | |
const CREATE = 'CREATE TABLE IF NOT EXISTS tasks (name VARCHAR(32) PRIMARY KEY, status INT)'; | |
const SELECT = 'SELECT * FROM tasks'; | |
const INSERT = 'INSERT INTO tasks VALUES (?,?)'; | |
const UPDATE = 'UPDATE tasks SET status = ? WHERE name = ?'; |
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
<?php | |
require_once 'PHPUnit/Framework/TestCase.php'; | |
require_once 'businessDays.php'; | |
/** | |
* businessDays() test case. | |
*/ | |
class BusinessDaysTest extends PHPUnit_Framework_TestCase { | |
protected function setUp() { | |
parent::setUp(); |
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
var timestamp = (long)DateTime.UtcNow | |
.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)) | |
.TotalMilliseconds; | |
//http://stackoverflow.com/questions/1877788/javascript-date-to-c-sharp-via-ajax | |
var date = new DateTime(1970, 1, 1).AddTicks(timestamp * 10000); |
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
public static Dictionary<char, int> teste(string url) | |
{ | |
var arUrl = url.ToCharArray(); | |
var gUrl = arUrl.GroupBy(n => n); | |
Console.WriteLine(gUrl.Count()); | |
var pos = new Dictionary<char, int>(); |