Skip to content

Instantly share code, notes, and snippets.

@smonn
smonn / package.json
Last active June 28, 2022 15:59
Reproduce issue with fast-json-stringify v5 and @sinclair/typebox
{
"name": "fjs-v5-typebox",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "ts-node src/index.ts"
},
"dependencies": {
"@sinclair/typebox": "0.23.5",
"fast-json-stringify": "5.0.3"
import Foundation
class WebRequest: NSObject {
let request: NSMutableURLRequest
init(method: String, url: String) {
self.request = NSMutableURLRequest(URL: NSURL(string: url)!)
self.request.HTTPMethod = method
}
@smonn
smonn / curry.js
Last active October 20, 2015 15:53
curry method for javascript with support for context
// curry(fn[, context[, arity[, params...]]])
var curry = function (fn, context, arity) {
var args = Array.prototype.slice.call(arguments, 0);
if (!context) {
context = context || undefined;
args[1] = context;
}
if (!arity) {
body {
margin: 0;
}
.fixed-size {
width: 430px;
height: 240px;
position: absolute;
top: 50%;
left: 50%;
@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
@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 / 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;
/* 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 / 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
{
@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;