Skip to content

Instantly share code, notes, and snippets.

View ppanyukov's full-sized avatar

Philip Panyukov ppanyukov

  • UK
View GitHub Profile
@ppanyukov
ppanyukov / markdown.vim
Created June 15, 2011 12:06 — forked from natesilva/markdown.vim
Vim: Preview a Markdown document in the default browser on Windows or Mac OS X
"
" While editing a Markdown document in Vim, preview it in the
" default browser.
"
" Author: Nate Silva
"
" To install: Place markdown.vim in ~/.vim/ftplugin or
" %USERPROFILE%\vimfiles\ftplugin.
"
" To use: While editing a Markdown file, press ',p' (comma p)
@ppanyukov
ppanyukov / p4x.sh
Created June 20, 2011 10:13
Support git-like aliases for Perforce p4
#!/bin/bash
#
# A kind of an alias support for the Perforce p4.
#
# This one aliases "interchanges" and "changes" commands to be printed out nicely in format:
#
# Change <change_no> on <date> by <user>@<workspace> [<status>]
# <first line of change description>
# --
# Change <change_no> on <date> by <user>@<workspace> [<status>]
@ppanyukov
ppanyukov / gist:1035407
Created June 20, 2011 10:22
Using p4merge with Git Mac OS X or Ubuntu

Git config

$ git config --global -e
[merge]
    keepBackup = false;
    tool = p4merge
[mergetool "p4merge"]
    cmd = p4merge "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

keepTemporaries = false

@ppanyukov
ppanyukov / p4changes.sh
Created June 20, 2011 10:36
Print Perforce commit stats by user between two specified dates
#!/bin/bash
#
# A kind of an alias support for the Perforce p4.
#
# This one aliases "interchanges" and "changes" commands to be printed out nicely in format:
#
# Change <change_no> on <date> by <user>@<workspace> [<status>]
# <first line of change description>
# --
# Change <change_no> on <date> by <user>@<workspace> [<status>]
@ppanyukov
ppanyukov / combinePdfFiles.tex
Created June 20, 2011 12:30
Combine several PDF files into one using LaTeX
% Many a time we have HTML articles published across multiple pages.
% And sometimes we want to print all those pages as one PDF.
% Here is how to do it:
% - Print into PDF from the browser into files like p01.pdf, p02.pdf etc
% - Use LaTeX to assemble these into one PDF.
%
% Here is the example. The \includepdf command supports scaling too,
% and I'm sure some other interesting commands as well.
%
% [copylifted from: http://yusung.blogspot.com/2007/02/combine-several-pdf-files-using-latex.html]
@ppanyukov
ppanyukov / gist:1051835
Created June 28, 2011 18:38
F# function to join sequence of strings using a delimiter without conversion to array
open System
open System.Text
/// Join a sequence of strings using a delimiter.
/// Equivalent to String.Join() but without arrays.
let join (items : seq<string>) (delim : string) =
// Collect the result in the string builder buffer
// The end-sequence will be "item1,delim,...itemN,delim"
let buff =
Seq.fold
@ppanyukov
ppanyukov / Prelude.cs
Created July 29, 2011 09:31 — forked from anonymous/Prelude.cs
Oh, you poor, poor imperative developers...
/* Prelude.cs : What happens when a haskell programmer learns C#.
Copyright (c) 2011 Clark Gaebel
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
@ppanyukov
ppanyukov / about.md
Created August 10, 2011 11:46 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@ppanyukov
ppanyukov / LogAgent.fs
Created March 13, 2012 03:07
Asynchronous log writer implemented using F# agent
module LogAgent =
// Log writer implementation using F# asynchronous agents
// Written as an excersise
open System
open System.IO
type private Message =
@ppanyukov
ppanyukov / FooBar.cs
Created September 21, 2012 10:58
Cool way to create, embed, and structure tests
internal static class FooBar
{
private static void DoStuff()
{
}
private static class SelfTests
{
[TestFixture]