Skip to content

Instantly share code, notes, and snippets.

@olund
olund / qsort
Created December 10, 2013 09:33
void qsort(int array[], int end, int start = 0) {
int i=start, j = end;
int temp;
int pivot=array[(start+end)/2];
cout << "Sorterar från " << start << " till " << end << " pivot " << pivot << endl;
while (i <= j) {
while (array[i] < pivot) {
i++;
void printRecursiveReverseString(string s) {
// Om strängens längd är 0, returnera
if(s.length() == 0 ) {
return;
}
// Character är tar den första charen i strängen
//cout << "Character: " << s.substr(0, 1) << endl;
string character = s.substr(0, 1);
// rekursivt anrop (Kallar på sig själv).
int main()
{
locale swedish("swedish");
locale::global(swedish);
srand((unsigned)time(NULL));
string playerName;
int nrOfCardDecks = 1;
int cardSum = 0;
int cardPos = 0;
Card lastCard;
@olund
olund / hej
Created February 4, 2014 21:38
nob jon
{
"installed_packages":
[
"DocBlockr",
"Emmet",
"Gist",
"Package Control",
"SendToPasteBin",
"SFTP",
"SublimeLinter",
alias commit='git commit -m'
alias l='ls -lF'
#trolol alias because of http://xkcd.com/530
alias highvolume="osascript -e 'set volume 7'"
alias mute="osascript -e 'set volume output muted true'"
# List only directories
alias lsd='ls -l ${colorflag} | grep "^d"'
template<typename T>
void List<T>::insertAt(T data, int pos) {
// Om pos = 0, lägg först
// Listan är tom: lägg först
// Pos > antalet noder, lägg sist
// pos > & <= antalet noder lägg emellan.
// skapa en ny nod
if(pos < 0) {
@olund
olund / .zshrc
Created April 25, 2014 10:18
My .zshrc file
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="intheloop"
# Example aliases
{
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Eighties.tmTheme",
"default_encoding": "UTF-8",
"default_line_ending": "unix",
"detect_indentation": false,
"file_exclude_patterns":
[
".DS_Store",
"Desktop.ini",
"*.pyc",
INSERT INTO Deliveries (S, P, QTY)
VALUES (1, 1, 300),
(1,2,200),
(1,3,400),
(1,4,200),
(1,5,100),
(1,6,100),
(2,1,300),
(2,2,400),
@olund
olund / PrefSublime
Created October 23, 2014 08:49
Olund Sublime Text 2
{
"color_scheme": "Packages/Predawn/predawn.tmTheme",
"default_encoding": "UTF-8",
"default_line_ending": "unix",
"detect_indentation": false,
"file_exclude_patterns":
[
".DS_Store",
"Desktop.ini",
"*.pyc",