Skip to content

Instantly share code, notes, and snippets.

View DanielOberg's full-sized avatar

Daniel Öberg DanielOberg

View GitHub Profile

Keybase proof

I hereby claim:

  • I am danieloberg on github.
  • I am danielob (https://keybase.io/danielob) on keybase.
  • I have a public key ASC0JfIlgRTT5wWRBeTd7J2c5mHJToYJW9x_0RUfYF1U8go

To claim this, I am signing this object:

# 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="cloud"
# Example aliases
set nocompatible " Must come first because it changes other options.
filetype off " Necessary on some Linux distros for pathogen to properly load bundles
" *********************************************
" * Vundle - Vim Plugins *
" *********************************************
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" Let Vundle manage Vundle
@DanielOberg
DanielOberg / erlang_debug_with_breakpoints.md
Last active December 11, 2015 17:49
Erlang Debugging

% How to break at a specific line with the Erlang shell

im(). % start Erlang debugger monitor

ii(modulename). % specify module

ib(modulename, 13). % set breakpoint (line number 13)

iaa([break]). % tell debugger to start debugging when breakpoint is hit

@DanielOberg
DanielOberg / HTTPSOAPRequest.cs
Created November 23, 2010 15:37
Gives a queryable XDocument without namespace problems
/*
XDocument result = HttpSOAPRequest(string_to_send, to_this_url);
var resultatLinq = from c in result.Descendants("something")
select c.Element("something_else");
*/
XDocument HttpSOAPRequest(String xmlfiletosend, string url) {
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlfiletosend);
@DanielOberg
DanielOberg / tasks.cs
Created November 5, 2010 09:52
Async calling as it was ment to be.
//http://msdn.microsoft.com/en-us/library/dd537609.aspx
Task[] tasks = new Task[3]
{
Task.Factory.StartNew(() => MethodA()),
Task.Factory.StartNew(() => MethodB()),
Task.Factory.StartNew(() => MethodC())
};
//Block until all tasks complete.
Task.WaitAll(tasks);
/*
Put your "encrypted" (ROT13) email address in a link and this script will decrypt it.
This helps against SPAM-bots (they almost never have a javascript engine running,
it's to computationally expensive to be worthwhile).
Useage:
<a href="mailto:qrzb@qrzb.pbz">qrzb@qrzb.pbz</a>
Becomes
@DanielOberg
DanielOberg / Global.asax
Created October 6, 2010 14:24
MVC.Net Routes with numbers
// Route where an argument must be a number to match
routes.MapRoute("NewsDetails", "News/{id}/{title}",
new { controller = "News", action = "Details"},
new { id = @"\d+" }); // NOTE THIS
@DanielOberg
DanielOberg / 100percent_height.css
Created September 23, 2010 08:49
CSS - 100% height with footer
/**
* Minimal version of:
* http://www.xs4all.nl/~peterned/examples/csslayout1.html
*/
html,body {
margin:0;
padding:0;
height:100%; /* needed for container min-height */
}
@DanielOberg
DanielOberg / html5_hover.js
Created September 15, 2010 11:02
(X)HTML 5 hover effect with prefetch.
// (X)HTML 5 hover effect with prefetch.
// By DanielO
//
// Usage: <img src="pic.png" alt="Pic" data-img-hover="hover.png" />
//
// Just add the data-img-hover attribute to your image and your good to go.
// Note that data-* attributes are new to HTML 5.
$(function () {