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
(defmacro when-let-> | |
"Takes an expression and a set of binding+test/form pairs. Threads expr (via ->) | |
through each form for which the corresponding test | |
expression is true, binding the result of the test." | |
[expr & clauses] | |
(assert (even? (count clauses))) | |
(let [g (gensym) | |
pstep (fn [[[res test] step]] `(if-let [~res ~test] (-> ~g ~step) ~g))] | |
`(let [~g ~expr |
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
(defun nrepl-eval-expression-at-point-in-repl () | |
(interactive) | |
(let ((form (nrepl-expression-at-point))) | |
;; Strip excess whitespace | |
(while (string-match "\\`\s+\\|\n+\\'" form) | |
(setq form (replace-match "" t t form))) | |
(set-buffer (cider-current-repl-buffer)) | |
(goto-char (point-max)) | |
(insert form) | |
(nrepl-return))) |
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
(defun nrepl-eval-expression-at-point-in-repl () | |
(interactive) | |
(let ((form (nrepl-expression-at-point))) | |
;; Strip excess whitespace | |
(while (string-match "\\`\s+\\|\n+\\'" form) | |
(setq form (replace-match "" t t form))) | |
(set-buffer "*nrepl*") | |
(goto-char (point-max)) | |
(insert form) | |
(nrepl-return))) |
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
#! /bin/bash | |
# Original Author: Shirish Padalkar (https://twitter.com/_Garbage_) | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 infoq_presentation_url" | |
exit 1 | |
fi | |
url_with_spaces=`curl -silent -A "Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10" $1 | grep "<source src=" | tr -dc "[:print:]"` |
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 static class BulkInsert | |
{ | |
private static SqlConnection Connection | |
{ | |
get { return NHibernateSession.NHibernateSessionManager.Instance.GetSession().Connection as SqlConnection; } | |
} | |
public static void Meters(IEnumerable<EisMeter> meters) | |
{ |
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 DatabaseSnapshot: IDisposable | |
{ | |
private readonly SqlConnection connection; | |
private readonly string database; | |
private bool disposed; | |
public DatabaseSnapshot() | |
: this(NHibernateSession.NHibernateSessionManager.Instance.GetStatelessSession().Connection as SqlConnection) | |
{} |
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
using System; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Runtime.Serialization; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using System.Xml.Serialization; | |
namespace ClassLibrary1 | |
{ | |
[Serializable] |
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
Set-StrictMode -version Latest | |
function Test-FileDep($a,$b) { | |
$bExists = test-path $b | |
$aTs = (Get-Item $a).LastWriteTime | |
return $bExists -and $aTs -le (Get-Item $b).LastWriteTime | |
} | |
function Update-Path($val) { |
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 New-SqlServerAlias($name, $server='.', $protocol='tcp', $port='1433') { | |
$options = New-Object System.Management.ConnectionOptions | |
$options.Context.Add('__ProviderArchitecture', 64) | |
$path = '\\.\root\microsoft\sqlserver\computermanagement11' | |
$scope = New-Object System.Management.ManagementScope($path, $options) | |
$scope.Connect() | |
$managementPath = New-Object System.Management.ManagementPath('SqlServerAlias') | |
$class = New-Object System.Management.ManagementClass($scope, $managementPath, $null) |
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
(defvar *tfs-server* "http://hqvm32:8080") | |
(defvar *tfs-root* "/tfs/Calico/EIS") | |
(defun org-open-tfs (item) | |
(browse-url (concat *tfs-server* *tfs-root* "/_workItems#_a=edit&id=" item))) | |
(org-add-link-type "tfs" 'org-open-tfs) |