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 Dictionary<string, object[]> CompareObjects<T>(T obj1, T obj2) | |
{ | |
var result = new Dictionary<string, object[]>(); | |
typeof(T) | |
.GetProperties() | |
.Select(p => new { p.Name, Val1 = p.GetValue(obj1, new object[] { }), Val2 = p.GetValue(obj2, new object[] { }) }) | |
.Where(i => i.Val1 != i.Val2) | |
.ToList() | |
.ForEach(p => result.Add(p.Name, new[] { p.Val1, p.Val2 })); |
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 class PrettyPrinterWithNeq : PrettyPrinter | |
{ | |
public override string PrettyPrint(Expr that) | |
{ | |
var n = that as Neg; | |
if (n != null) return "-(" + PrettyPrint(n.operand) + ")"; | |
return base.PrettyPrint(that); | |
} | |
} |
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
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> | |
Поиск по узлу | |
</asp:Content> | |
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> | |
<script type="text/javascript"> | |
function loadFormWithHash() { | |
$.get('<%= Url.Action("SearchForm","Person") %>?' + window.location.hash.slice(1), | |
function (data) { | |
$('#searchContainer').html(data); |
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
# | |
# This script will install the following Textmate bundles | |
# | |
# Languages | |
# - c https://github.com/textmate/c.tmbundle | |
# - coffeescript https://github.com/jashkenas/coffee-script-tmbundle | |
# - context free https://github.com/textmate/context-free.tmbundle | |
# - erlang https://github.com/textmate/erlang.tmbundle | |
# - haskell https://github.com/textmate/haskell.tmbundle.git | |
# - html https://github.com/textmate/html.tmbundle |
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
import Control.Monad | |
import Data.Char | |
import System.IO | |
import Network | |
import Data.Time.LocalTime | |
data RequestType = GET | POST deriving (Show) | |
data Request = Request { rtype :: RequestType, path :: String, options :: [(String,String)] } | |
data Response = Response { version :: String, statuscode :: Int } |
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 S4() { | |
return (((1+Math.random())*0x10000)|0).toString(16).substring(1); | |
} | |
function guid() { | |
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); | |
} |
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
curl -o /tmp/weather.html http://weather.yahoo.com/russia/moskva/moscow-2122265/; | |
curl -o /tmp/currenttemp.png `grep 'div class="forecast-icon" style="background:url(' /tmp/weather.html | awk -F"'" '{ print $2 }'` |
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
$ver = $host | select version | |
if ($ver.Version.Major -gt 1) {$Host.Runspace.ThreadOptions = "ReuseThread"} | |
Add-PsSnapin Microsoft.SharePoint.PowerShell | |
$spAdminServiceName = "SPAdminV4" | |
Stop-Service -Name $spAdminServiceName | |
$deployedSolutions = Get-SPSolution | Where-Object {$_.Deployed -eq $true} | |
if($deployedSolutions) | |
{ | |
foreach($solution in $deployedSolutions) |
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
wget -r -l1 -A.mp3 <url> | |
#http://techpatterns.com/forums/about894.html |
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
import csv | |
def find_crossing(a, low, mid, high): | |
max_left = 0 | |
max_right = 0 | |
left_sum = -1e308 | |
sum = 0 | |
for i in range(mid, low, -1): | |
sum = sum + a[i][1] |
OlderNewer