Skip to content

Instantly share code, notes, and snippets.

View DanAtkinson's full-sized avatar
🏠
Working from home

Dan Atkinson DanAtkinson

🏠
Working from home
View GitHub Profile
@andyedinborough
andyedinborough / jquery.oauth.js
Created June 7, 2011 19:30
Introduces $.oauth() to make using OAuth from jQuery as easy as using $.ajax()
(function (window, document, $, undefined) {
if (!$.Deferred) throw 'jQuery 1.5 is required to use the jQuery.oauth script!';
function require(name, url) {
if (window[name] === undefined)
return $.ajax({ type: 'GET', cache: true, dataType: 'script', url: url });
}
$.oauth = function (options) {
var d = $.Deferred();
@mythz
mythz / AuthorService.cs
Created February 10, 2012 07:36
1 class in ServiceStack
/*
With no other C# or config other than OrmLite DB config in AppHost below - this web service provides all the screenshots attached, out-of-the-box, for free.
container.Register<IDbConnectionFactory>(
new OrmLiteConnectionFactory(ConfigUtils.GetConnectionString("AppDb"), //ConnectionString in Web.Config
SqlServerOrmLiteDialectProvider.Instance) {
ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) });
-- Code-first Simplicity at Great Speed - http://www.servicestack.net/benchmarks/
@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

@haf
haf / gist:2843680
Created May 31, 2012 14:19
Get SSH working on Vagrant/Windows/Git

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

# if Util::Platform.windows?
  # raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                       # :port => ssh_info[:port],
                                       # :username => ssh_info[:username],
 # :key_path =&gt; ssh_info[:private_key_path]
@erichexter
erichexter / gist:3717010
Created September 13, 2012 19:35
install chocolatey with windows auth proxy
Set-ExecutionPolicy -ExecutionPolicy Unrestricted;$a=new-object net.webclient;$a.proxy.credentials=[system.net.credentialcache]::defaultnetworkcredentials;$a.downloadstring('http://bit.ly/OKgXHP')|iex
@jbolster
jbolster / contenteditable.bookmarklet.js
Created April 7, 2014 09:27
Edit all the things!
javascript:[].forEach.call(document.querySelectorAll("*"),function(e){e.setAttribute("contenteditable","true")})
@jbolster
jbolster / autocompleteon.bookmarklet.js
Created April 7, 2014 09:54
Enable all the autocompletes!
javascript:[].forEach.call(document.querySelectorAll("form,input"), function(e){ e.removeAttribute("autocomplete")})
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 20, 2024 16:52
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@jimbuck
jimbuck / InvalidModelException.cs
Created August 11, 2014 17:57
C# Validation Helper
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
namespace JimmyBoh.Common.Exceptions
{
public class InvalidModelException : Exception
{