Skip to content

Instantly share code, notes, and snippets.

View pinscript's full-sized avatar

Alexander Berg pinscript

View GitHub Profile
@pinscript
pinscript / laugh.js
Last active August 29, 2015 13:59
laugh.js
if(message.toLowerCase() == "haha") {
var images = [
"http://i.imgur.com/tyROdzN.gif",
"http://i.imgur.com/L24cy.gif",
"http://i.imgur.com/nJTgg7p.gif",
"http://i.imgur.com/VaAvSEj.gif",
"http://i.imgur.com/rU2jU8X.gif",
"http://i.imgur.com/cUqCb7Y.gif",
"http://i.imgur.com/yFtfY.gif",
using System;
using System.Diagnostics;
namespace Stemmer
{
internal class Benchmark : IDisposable
{
private readonly string _name;
private Stopwatch _stopwatch;
var doc = new HtmlDocument();
doc.LoadHtml(html);
var nodes = doc.DocumentNode.SelectNodes("//span[contains(@class,'video-title')]");
Console.WriteLine("Node count: {0}", nodes.Count); // 1
Console.WriteLine("Title: {0}", nodes.First().InnerText); // Bob Marley - Buffalo soldier
YZbDcQ2jHgpjhmID8QiJknFMQd5e2m8C9IBPJEzQ0pI=
83ed1b47-4dc3-11e1-a216-000000008329
-- MySQL dump 10.13 Distrib 5.5.16, for Win32 (x86)
--
-- Host: localhost Database: elmah
-- ------------------------------------------------------
-- Server version 5.5.16-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
<html>
<head>
<style type="text/css">
#drop {
width: 300px;
height: 46px;
border: 3px dashed #c9c9c9;
text-align: center;
padding-top: 25px;
}
@pinscript
pinscript / gist:3898575
Created October 16, 2012 10:35
FastSort
<html>
<head>
<title>Tablesorter</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
(function($) {
$.fn.fastSort = function() {
var DESC = 0,
private static Dictionary<string, Dictionary<string, string>> Parse(string xpath)
{
var results = new Dictionary<string, Dictionary<string, string>>();
var parts = xpath.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
foreach(var part in parts)
{
var itemName = part.Substring(0, part.IndexOf('['));
var properties = Regex.Matches(part, "@([a-zA-Z]+)='([a-zA-Z]+)'");
$players = array();
while($row = mysql_fetch_array($result))
{
extract($row);
$player = array (
'cbs_id' => $cbs_id,
'fname' => $fname,
'lname' => $lname,
'stats' => array()