Skip to content

Instantly share code, notes, and snippets.

@smonn
smonn / mediaqueryfix.css
Last active December 14, 2015 20:09
Required CSS when working with media queries.
html { height: 100%; overflow: hidden; }
body { height: 100%; overflow: auto; }
using System;
using System.Linq;
namespace SystemExtensions
{
public static class HexadecimalExtensions
{
/// <summary>
/// Converts a byte array to a hexadecimal string.
using System;
using System.Linq;
var bytes = new byte[] { /* ... */ };
var hex = new string(bytes.SelectMany(x => x.ToString("x2").ToCharArray()).ToArray());
var data = Enumerable.Range(0, hex.Length).Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
.ToArray();
@smonn
smonn / customselect.css
Last active December 17, 2015 06:49
Custom HTML select with CSS and JavaScript.
.custom-select-container {
position: relative;
margin: 5px 0 0 0;
overflow: hidden;
}
.custom-select-container .replaced {
border: 0;
filter: alpha(opacity=0); /* Move to IE-specific CSS file if you want to. */
line-height: 24px;
@smonn
smonn / HelloService.cs
Last active December 18, 2015 16:39
Who said WCF (svc) requires more configuration than a web service (asmx)? When it comes to hosting a simple web service which only purpose is to communicate through Ajax and JSON, this is enough. And no, nothing (related to WCF configuration) needs to be put in the web.config. See http://msdn.microsoft.com/en-us/library/bb472534(v=vs.90).aspx fo…
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
namespace Namespace
{
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class HelloService
{
/* apply a natural box layout model to all elements */
*, *:before, *:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@smonn
smonn / AesCrypto.cs
Last active August 29, 2015 13:57
Simple class for AES encryption and decryption. Key can be any string, internally it will be converted to an MD5 hash. The IV must be exactly 16 bytes (8 character long string).
using System;
using System.IO;
using System.Security.Cryptography;
public class AesCrypto : ICrypto
{
public const int IV_Length = 16;
private byte[] _key;
private byte[] _iv;
@smonn
smonn / ko.bindingHandlers.dataTable.js
Last active August 29, 2015 14:09
knockout.js binding handler for http://www.datatables.net
/*global jQuery: false, ko: false */
(function ($, ko) {
'use strict';
// based on the work by http://chadmullins.com/
// some caveats to be aware of:
// - x-editables: when clicking a sortable column the editable-unsaved css
// class gets removed since each row is re-rendered
// - data-bind on <tr/> is not supported (yet)
@smonn
smonn / README.md
Last active March 19, 2025 09:25
How to install git-flow in Windows

How to install git-flow in Windows

When it says "Run command", copy and paste the command part into a CLI, such as Powershell or the command prompt (make sure Git is in the path).

  1. Make sure Git is installed.
  2. From http://gnuwin32.sourceforge.net/packages/util-linux-ng.htm, download the binaries and dependencies zip-files.
  3. Extract them and copy the contents of the bin-folders into your Git installation's bin folder, for example C:\Program Files (x86)\Git\bin. To find out where it is run where.exe git.
  4. Set root directory to where you want to clone git-flow.
  5. Run git clone --recursive git://github.com/nvie/gitflow.git
body {
margin: 0;
}
.fixed-size {
width: 430px;
height: 240px;
position: absolute;
top: 50%;
left: 50%;