Skip to content

Instantly share code, notes, and snippets.

View draptik's full-sized avatar

Patrick Drechsler draptik

View GitHub Profile
@draptik
draptik / JS-LINQ.js
Created July 18, 2016 17:08 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
@draptik
draptik / CustomerController.cs
Created November 8, 2016 19:40 — forked from vkhorikov/CustomerController.cs
Handling failures and input errors in a functional way
[HttpPost]
public HttpResponseMessage CreateCustomer(string name, string billingInfo)
{
Result<BillingInfo> billingInfoResult = BillingInfo.Create(billingInfo);
Result<CustomerName> customerNameResult = CustomerName.Create(name);
return Result.Combine(billingInfoResult, customerNameResult)
.OnSuccess(() => _paymentGateway.ChargeCommission(billingInfoResult.Value))
.OnSuccess(() => new Customer(customerNameResult.Value))
.OnSuccess(
#!/bin/bash
gem install bundler execjs
cd /octopress
# Important: use `--path...`!
bundle install --path $HOME/.gem
#!/bin/bash
docker run \
--rm \
-it \
-e LOCAL_USER_ID=`id -u $USER` \
-p 4001:4001 \
-v ${PWD}/share/octopress:/octopress \
-v ${PWD}/post-install.sh:/home/user/post-install.sh \
draptik/octopress:0.2 \
@draptik
draptik / .gitconfig
Created March 14, 2017 21:51
git settings
[push]
default = simple
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ec = config --global -e
s = status
co = checkout
cob = checkout -b
up = pull --rebase
cm = !git add -A && git commit -m
@draptik
draptik / Class1.cs
Created July 31, 2017 21:15
xunit-net-collection-fixtures
using FluentAssertions;
using Xunit;
namespace FooTests
{
/// <summary>
/// https://xunit.github.io/docs/shared-context.html#collection-fixture
///
/// Important note: Fixtures can be shared across assemblies, but collection definitions must
/// be in the same assembly as the test that uses them.
#!/bin/bash
## Temporary workaround for ncurses bug (https://github.com/dotnet/corefx/issues/26966#issuecomment-367066252)
export TERM=xterm
DEMOPROJECT=MyLib
## Cleanup
rm -rf $DEMOPROJECT
#!/bin/bash
INPUT_FILE="vo_all.pdf"
OUTPUT_FILE_BASE="vo_all_output"
pdfjam --nup 2x3 \
--frame true \
--noautoscale false \
--delta "0.2cm 0.3cm" \
--scale 0.95 \
@draptik
draptik / clmystery-solution.md
Last active February 4, 2024 17:42
A solution to clmystery: A Command line murder mystery (https://github.com/veltman/clmystery)

Solving the riddle

A solution to clmystery: Command line murder mystery.

Get all clues

grep "CLUE" crimescene

CLUE: Footage from an ATM security camera is blurry but shows that the perpetrator is a tall male, at least 6'.
-- https://mystery.knightlab.com/walkthrough.html
-- witness 1
--SELECT * from interview where person_id = 14887
--select * from get_fit_now_member where id like '48Z%' and membership_status = 'gold'
--select * from drivers_license where plate_number like '%H42W%'
-- witness 1
--select p.* from person p
--join drivers_license dl on p.license_id = dl.id