Skip to content

Instantly share code, notes, and snippets.

View drch-'s full-sized avatar

Daryl Harrison drch-

View GitHub Profile
@drch-
drch- / .gitignore
Created March 22, 2019 11:24
vscode + visual studio + rider(JetBrains) gitignore
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
@drch-
drch- / vsts.yaml
Created September 6, 2018 02:22
conditionally run template depending on branch - doesn't work
# build docker image
- template: tasks/_docker-build.yml
parameters:
workingDirectory: $(projectBaseDir)
tag: $(dockerImage)-$(Build.BuildId)
# tag and push images if branch is master or develop
- ${{ if in('$(Build.SourceBranchName)', 'develop', 'master') }}:
- template: tasks/_awscli-docker-login.yml
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./tint.py" ]
class Program
{
static void Main(string[] args)
{
var words = File.ReadAllLines("words.txt").Select(x => new Word(x)).ToArray();
var candidate = new Word("ethylenediaminetetraacetates");
var watch = new Stopwatch();
@drch-
drch- / appsettingloader.cs
Created August 17, 2012 16:03
typed appsesttings config reader
public class AppSettingsLoader
{
public static T Load<T>() where T : new()
{
var props = typeof (T).GetProperties();
var result = new T();
foreach (var prop in props)
{
var name = GetSettingName(prop);
var setting = ConfigurationManager.AppSettings[name];
@drch-
drch- / project.msbuild
Created April 29, 2012 15:26
Running AjaxMin on sets of files at build time
<Target Name="AfterBuild">
<CallTarget Targets="MinifyJs" />
</Target>
<PropertyGroup>
<AjaxMin>"C:\Program Files (x86)\Microsoft\Microsoft Ajax Minifier\AjaxMin.exe"</AjaxMin>
</PropertyGroup>
<Target Name="MinifyJs">
<ItemGroup>
@drch-
drch- / util.js
Created April 12, 2012 16:15
misc js utils
util = {
//calls a func every [timeout] ms for [stopMillis] ms.
//returns a jQuery.Promise
every: function (func, timeout, stopMillis, callnow) {
function _every(func, timeout, absoluteStop, deferred) {
if (new Date().getTime() >= absoluteStop) {
deferred.resolve();
return;
}
func();
//hitMe / hitUs : sends the server the current timestamp and the number of calls to make back to the client. hitMe: just the callign client, hitUs: all clients on the hub.
//stepOne / stepAll : increments a counter
//doneOne / doneAll : prints # of messages and total duration.
$(function () {
function log(message) {
var $newMessage = $("<li/>", { text: message });
$("#messages").prepend($newMessage);
return $newMessage;
};
@drch-
drch- / HubBench.cs
Created April 11, 2012 14:35
signalr bench
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SignalR.Hubs;
using System.Threading;
namespace SignalRBench
{
public class HubBench : Hub, IConnected, IDisconnect
@drch-
drch- / gist:1402784
Created November 29, 2011 00:34
RazorEngine Model/Layout Test
using System;
using System.Collections.Generic;
using RazorEngine.Configuration;
using RazorEngine.Templating;
namespace RazorTest
{
internal class Program
{
private static void Main(string[] args)