Skip to content

Instantly share code, notes, and snippets.

View hakonrossebo's full-sized avatar

Håkon Rossebø hakonrossebo

View GitHub Profile
@cstrahan
cstrahan / SolarInfo.cs
Created January 6, 2011 05:06
A sunrise/sunset calculator.
using System;
using System.Diagnostics;
namespace SunriseCalculator
{
public class SolarInfo
{
public double SolarDeclination { get; private set; }
public TimeSpan EquationOfTime { get; private set; }
public DateTime Sunrise { get; private set; }
@cobyism
cobyism / gh-pages-deploy.md
Last active May 17, 2024 10:22
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@jongalloway
jongalloway / PcRepave.cmd
Last active February 23, 2023 18:02
Chocolatey list generated using: choco list --localonly --idonly
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco feature enable -n allowGlobalConfirmation
choco install 7zip /y
choco install 7zip.install /y
choco install ARMClient /y
choco install audacity /y
choco install audacity-lame /y
choco install autohotkey /y
choco install autohotkey.install /y
exception ItemAlreadyExists of string
exception ItemNotFound of string
exception DomainError of string
type Command =
| CreateInventoryItem of Id: int
| RenameInventoryItem of Id: int * Name: string
| RemoveItemsFromInventory of Id: int * Amount: int
| AddItemsToInventory of Id: int * Amount: int
| DeactivateInventoryItem of Id: int
@definitelynotsoftware
definitelynotsoftware / AngularJS-Windows-Authentication.authentication.js
Last active December 4, 2019 14:31
AngularJS Windows Authentication Service using .NET Web API and Hot Towel template
angular.module('app')
.factory("authentication", ["$http", "$q", "$window", authentication]);
function authentication($http, $q, $window) {
var user;
function login() {
// check if the user already exists for this session
@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@vbfox
vbfox / Dapper.fs
Last active April 21, 2022 02:58
Minimal dapper in F#
module DapperFSharp =
open System.Data.SqlClient
open System.Dynamic
open System.Collections.Generic
open Dapper
let dapperQuery<'Result> (query:string) (connection:SqlConnection) =
connection.Query<'Result>(query)
let dapperParametrizedQuery<'Result> (query:string) (param:obj) (connection:SqlConnection) : 'Result seq =
@yang-wei
yang-wei / destructuring.md
Last active February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
@swlaschin
swlaschin / 1-checkers-scratch-design.fsx
Last active March 17, 2022 16:06
Example of Domain Driven Design for the game of checkers. There are two files: a scratch file with a series of designs, and a final version.
(*
Example of domain-driven design for Checkers
Rules from here: https://www.itsyourturn.com/t_helptopic2030.html
A SERIES OF SCRATCH DESIGNS
*)
// As we go through the rules, and learn things, we create a series of designs
module Version1 =
@klaftertief
klaftertief / reactiveconf-2016-lightning-talk.md
Last active April 2, 2024 20:17
An API search engine in Elm for Elm, proposal for a Lightning Talk at ReactiveConf 2016

An API search engine in Elm for Elm

Elm is a statically typed functional language that compiles to JavaScript. It's well-known for its developer experience: the compiler provides nice error messages, the package system enforces semantic versioning for all published packages and makes sure every exposed value or type has some documentation and type annotations.