Skip to content

Instantly share code, notes, and snippets.

View asbjornu's full-sized avatar
💭
He's a loathsome offensive brute, yet I can't look away.

Asbjørn Ulsberg asbjornu

💭
He's a loathsome offensive brute, yet I can't look away.
View GitHub Profile
@scottlittlewood
scottlittlewood / NHibernateSessionPipelineContributor.cs
Created November 29, 2010 13:43
Shows a simple implementation of using an OpenRasta Pipeline Contributor to manage nHibernate Sessions on a per request basis
public class NHibernateSessionPipelineContributor : IPipelineContributor
{
private readonly IDependencyResolver _resolver;
public NHibernateSessionPipelineContributor(IDependencyResolver resolver)
{
_resolver = resolver;
}
public void Initialize(IPipeline pipelineRunner)
@SzymonPobiega
SzymonPobiega / gist:953302
Created May 3, 2011 13:10
Monads in action
protected override ValidationResults OnValidate(PurchaseTransaction purchaseTransaction)
{
return purchaseTransaction
.With(ValidationCheck)
.Unless(IsValidateServiceDown)
.Try(SendMessageToTransecure)
.InCaseOfException(MarkServiceAsDown)
.Return(TheResult, OrFailureCodeInCaseOfFailure);
}
<?php
/**
* Includes a few useful predicates in the bootstrapped `infiniteScroll` JS object
* that is served along with the rest of the document upon initial page request.
*/
add_filter( 'infinite_scroll_js_settings', 'pla_extra_js_settings' );
function pla_extra_js_settings( $js_settings ) {
$js_settings['text'] = __( "Plus de contenus", "pla" );
@panlw
panlw / MyLanguageGen.sh
Last active March 22, 2016 06:29
Use Antlr v4 to do code generation for .NET
#!/bin/sh
# Generate Lexer/Visitor for syntax tree of MyLanguage
# You should download the jar file from
# http://tunnelvisionlabs.com/downloads/antlr/2013-02-27-antlr4-csharp-4.0.1-SNAPSHOT.7z
java -cp .:./antlr4-csharp-4.0.1-SNAPSHOT-complete.jar org.antlr.v4.CSharpTool -Dlanguage=CSharp_v3_5 -no-listener -visitor -package MyNamespace MyLanguage.g4
@russellbeattie
russellbeattie / search-apple-mail-body.js
Created June 1, 2016 01:11
Searches Apple mail Inbox for your name (if your name is Russ - otherwise change that bit) in the latest message and logs out/marks yellow.
#!/usr/bin/env osascript -l JavaScript
function run(argv) {
var Mail = new Application("Mail");
var inbox = Mail.inbox();
var messages = inbox.messages();
@asbjornu
asbjornu / PayEx_CLA.md
Last active September 3, 2018 08:30 — forked from CLAassistant/SAP_CLA
PayEx Individual Contributor License Agreement

PayEx Individual Contributor License Agreement

Thank you for your interest in contributing to open source software projects (“Projects”) made available by PayEx or its affiliates (“PayEx”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to PayEx in respect of any of the Projects (collectively “Contributions”).

Contrary to “Closed Source” software or proprietary software – where a creator maintains exclusive control over his or her source code – “Open Source Software” is software with source code that anyone can inspect, modify, share, learn from and enhance. Outlined below you will find PayEx Individual Contributor License Agreement under which you as a contributor retain all of your rights, titles and interests in and to your con

.main_loop
jsr keyboard_read
jsr rs232_try_read_byte
cmp #0
bne .got_byte ; if we got a byte from serial conn, goto .got_byte...
jmp .main_loop ; ... otherwise, jump back to .main_loop
.got_byte
ldy flash_screen_on_data
beq .skip_screen_flash ; if screen flashing is not enabled, jump over flashing code
inc $d020 ; border_color++
@death
death / enamel.lisp
Created April 24, 2013 11:07
Old enamel hack
;;;; Enamel - Erik Naggum's Markup Language
;;;
;;; See http://xach.com/naggum/articles/3207626455633924@naggum.net.html
;;;
(define-condition malformed-enamel (error) ())
(defun parse-enamel (in &key (case :upcase) (strip-newlines t) (distinguish-attributes nil) (package *package*))
(let ((node '()))
(labels ((skip-ws () (peek-char t in nil))
@stephanvd
stephanvd / Rakefile
Created February 23, 2016 14:00
CodeCov setup for parallel_test gem
namespace :codecov do
desc 'Uploads the latest simplecov result set to codecov.io'
task upload: :environment do
require 'simplecov'
require 'codecov'
formatter = SimpleCov::Formatter::Codecov.new
formatter.format(SimpleCov::ResultMerger.merged_result)
end
end
@einarwh
einarwh / aoc1b.ps
Last active December 2, 2020 11:27
Advent of code 2020. Day 1, part b. PostScript version.
[ (input.txt) run ] % A
dup length 1 sub % L-1 A
0 exch % L-1 0 A
1 exch % L-1 1 0 A
{ % i A
exch % A i
1 index 1 add % i+1 A i
1 % 1 i+1 A i
2 index % A 1 i+1 A i
length 1 sub % L-1 1 i+1 A i