Skip to content

Instantly share code, notes, and snippets.

View jessejjohnson's full-sized avatar

Jesse Johnson jessejjohnson

View GitHub Profile
@jessejjohnson
jessejjohnson / Consulting Contract.md
Last active October 28, 2015 00:52
Consultant contract template.

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@jessejjohnson
jessejjohnson / dialog.js
Last active October 28, 2015 00:56 — forked from zjlgdx/dialog.js
Knockout Modal Binding
ko.bindingHandlers.dialog = {
init: function(element, valueAccessor, allBindingsAccessor) {
var options = ko.utils.unwrapObservable(valueAccessor()) || {};
options.close = function() {
allBindingsAccessor().dialogVisible(false);
};
$(element).dialog(options);
using System;
using System.IO;
using System.Linq;
using System.Text;
namespace AbpWebSite.Templates
{
/// <summary>
/// Used to rename a solution
/// </summary>
@jessejjohnson
jessejjohnson / App.ts
Last active August 26, 2016 21:22
Bootstrap modal as typescript class with custom event names
import { Modal} from "Modal";
let modal = new Modal("#mymodal");
modal.show();
@jessejjohnson
jessejjohnson / bootstrap-wrapper.css
Created September 26, 2016 18:50 — forked from onigetoc/bootstrap-wrapper.css
Bootstrap wrapper no conflict - Wrap Bootstrap v3.3.6 CSS inside a div with the class .bootstrap-wrapper
.bootstrap-wrapper {font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
/*.bootstrap-wrapper body{margin:0}*/
.bootstrap-wrapper article, .bootstrap-wrapper aside, .bootstrap-wrapper details, .bootstrap-wrapper figcaption, .bootstrap-wrapper figure, .bootstrap-wrapper footer, .bootstrap-wrapper header, .bootstrap-wrapper hgroup, .bootstrap-wrapper main, .bootstrap-wrapper menu, .bootstrap-wrapper nav, .bootstrap-wrapper section, .bootstrap-wrapper summary{display:block}
.bootstrap-wrapper audio, .bootstrap-wrapper canvas, .bootstrap-wrapper progress, .bootstrap-wrapper video{display:inline-block;vertical-align:baseline}
.bootstrap-wrapper audio:not([controls]){display:none;height:0}
.bootstrap-wrapper [hidden], .bootstrap-wrapper template{display:none}
.bootstrap-wrapper a{background-color:transparent}
.bootstrap-wrapper a:active, .bootstrap-wrapper a:hover{outline:0}
.bootstrap-wrapper abbr[title]{border-bottom:1px dotted}
.bootstrap-wrapper b, .bootstrap-wrapper strong{font-weigh
@jessejjohnson
jessejjohnson / reset.css
Created August 8, 2018 05:28
Simple CSS Reset
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video
{
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
@jessejjohnson
jessejjohnson / fiddle.css
Last active December 18, 2019 08:45
jsfiddle boilerplate
h1 {
color: #666;
}
@jessejjohnson
jessejjohnson / ObjectExtensions.cs
Last active December 18, 2019 08:27
Fast (three times faster than BinaryFormatter) deep object copy extension method
using System.Collections.Generic;
using System.Reflection;
using System.ArrayExtensions;
namespace System
{
public static class ObjectExtensions
{
private static readonly MethodInfo CloneMethod = typeof(Object).GetMethod("MemberwiseClone", BindingFlags.NonPublic | BindingFlags.Instance);
@jessejjohnson
jessejjohnson / SnowflakeIdGenerator.cs
Last active April 4, 2023 12:39
Generate Twitter Snowflake ID's
public class SnowflakeIdGenerator
{
public const byte DefaultMachineIdBits = 6;
public const byte DefaultSequenceBits = 12;
private readonly long _machineId = 0;
private readonly byte _machineIdBits = 0;
private readonly byte _sequenceBits = 0;
private readonly long _maxSequence = 0;
private readonly Stopwatch _stopwatch = Stopwatch.StartNew();
private readonly object _lockObject = new object();
@jessejjohnson
jessejjohnson / UnitTest.cs
Created September 30, 2021 18:16
Notable code snippets discovered in real-world solutions
try
{
throw new Exception("test");
}
catch (Exception ex)
{
Assert.Equal("test", ex.Message);
}