Skip to content

Instantly share code, notes, and snippets.

View stvedt's full-sized avatar

Sven Tvedt stvedt

View GitHub Profile
<Switch>
<AppRoute exact path="/" layout={BlankPage} component={Homepage} />
<AppRoute exact path="/about" layout={BlankPage} component={LearnMore} />
<Route exact path="/destination">
<Redirect to="/"/>
</Route>
<AppRoute exact path="/destination/:destinationId" layout={DefaultPage} component={SearchResults} />
<AppRoute exact path="/destination/detail/:destinationId" layout={DefaultPage} component={Trip} />
<AppRoute exact path="/destination/itinerary/:destinationId/:itineraryId" layout={DefaultPage} component={Itinerary} />
<AppRoute exact path="/order/booking/:destinationId/:packageId" layout={DefaultPage} component={Checkout} />
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
psycopg2.IntegrityError: duplicate key value violates unique constraint "django_content_type_app_label_76bd3d3b_uniq"
DETAIL: Key (app_label, model)=(auth, group) already exists.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
@stvedt
stvedt / curry.js
Created February 24, 2017 17:26
curry.js
var greetCurried = function(greeting) {
return function(name) {
console.log(greeting + ", " + name);
};
};
var greetHello = greetCurried("Hello");
greetHello("Heidi"); //"Hello, Heidi"
greetHello("Eddie"); //"Hello, Eddie"
@stvedt
stvedt / closures.js
Last active March 2, 2017 22:26
closures.js
var counter = (function() {
var privateCounter = 0;
function changeBy(val) {
privateCounter += val;
}
return {
increment: function() {
changeBy(1);
},
decrement: function() {
@stvedt
stvedt / thunks.js
Created February 17, 2017 19:19
Thunks
//synchronous thunk
function add(x,y){
return x + y;
}
//wrapper to return a value
var thunk = function(){
return add(10,15);
}
@stvedt
stvedt / gist:35d3809a87afb337fc84
Created April 25, 2015 18:39
H2A Spawn Times
30 second despawn (walk over resets despawn)
Shrine
Snipe 2:10
Rocks 2:30
Lockdown
Snipe 40s
Sword 40s
@stvedt
stvedt / about.html
Created April 8, 2013 15:17
Demonstration of a gracefully degrading and search engine optimized AJAX technique.
<!DOCTYPE html>
<html>
<head>
<title>Example by Stephen Tvedt</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<nav>
<a href="index.html">Home</a>
<a href="about.html">About</a>

Contract Killer 3

Revised date: 05/11/2013

Between us Stephen Tvedt and you [customer name]

Summary:

We’ll always do our best to fulfil your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. We’ve no desire to trick you into signing something that you might later regret. What we do want is what’s best for both parties, now and in the future.

@stvedt
stvedt / git-cheat-sheet.md
Created November 29, 2012 15:27 — forked from iansheridan/git-cheat-sheet.md
A cheat sheet for GIT

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file:

$(document).ready(function(){
var pageName = getPage();
$('#nav a').each(function(){
var $this = $(this);
var anchorHref = $this.attr('href');
if( anchorHref == pageName) $this.addClass('current');
});
function getPage(){