Skip to content

Instantly share code, notes, and snippets.

View samandmoore's full-sized avatar

Sam Moore samandmoore

View GitHub Profile
@linjunpop
linjunpop / Capybara-Rspec-Rails-assets-pipeline.md
Last active August 14, 2021 05:42
Capybara, Rspec, Rails assets pipeline
@nautat
nautat / index.html
Created November 16, 2012 07:10
Nested tables from json
<!DOCTYPE html>
<meta charset="utf-8">
<style type="text/css">
table {
font-family: "Helvetica", "Lucida Sans", "Lucida Sans Unicode", "Luxi Sans", Tahoma, sans-serif;
box-shadow: 1px 1px 10px rgba(0,0,0,0.5);
border-collapse: collapse;
border-spacing: 0;
}
table {
@davidfowl
davidfowl / today.cs
Created September 7, 2012 23:17
VNext SignalR API
Clients.addMessage(message);
Others.addMessage(message); // Does not exist yet
Clients[group].addMessage(message);
Clients[Context.ConnectionId].addMessage(message);
IClientProxy proxy = Clients;
proxy.Invoke("addMessage", message);
IClientProxy proxy1 = Clients[group];
proxy1.Invoke("addMessage", message);
@headius
headius / gist:3491618
Created August 27, 2012 19:34
JVM + Invokedynamic versus CLR + DLR

Too much for teh twitterz :)

JVM + invokedynamic is in a completely different class than CLR + DLR, for the same reasons that JVM is in a different class than CLR to begin with.

CLR can only do its optimization up-front, before executing code. This is a large part of the reason why C# is designed the way it is: methods are non-virtual by default so they can be statically inlined, types can be specified as value-based so their allocation can be elided, and so on. But even with those language features CLR simply cannot optimize code to the level of a good, warmed-up JVM.

The JVM, on the other hand, optimizes and reoptimizes code while it runs. Regardless of whether methods are virtual/interface-dispatched, whether objects are transient, whether exception-handling is used heavily...the JVM sees through the surface and optimizes code appropriate for how it actually runs. This gives it optimization opportunities that CLR will never have without adding a comparable profiling JIT.

So how does this affect dynamic

@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@glennblock
glennblock / gist:2722523
Created May 18, 2012 00:57
Autofac dependency resolver and scope
public class AutofacApiDependencyResolver : AutofacDependencyScope, IDependencyResolver
{
private readonly ILifetimeScope _container;
public AutofacApiDependencyResolver(ILifetimeScope container) : base(container)
{
_container = container;
}
public IDependencyScope BeginScope()
@aaronpowell
aaronpowell / License.md
Created May 16, 2012 07:18
A useful exception for when you don't want to implement a feature yourself

The MIT License

Copyright (c) 2012 Aaron Powell

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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWA

@mxriverlynn
mxriverlynn / commands.js
Created May 3, 2012 21:20
AJAX "Command" wrapper
// register a command
Commands.register("login", {
url: "/login",
type: "POST"
});
// later in the application, get the command
@bradwilson
bradwilson / My.Types.ps1xml
Created May 2, 2012 03:54
My profile.ps1 (and several related scripts)
<Types>
<Type>
<Name>System.String</Name>
<Members>
<ScriptProperty>
<Name>ToBase64</Name>
<GetScriptBlock>
[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($this))
</GetScriptBlock>
</ScriptProperty>
@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>