Skip to content

Instantly share code, notes, and snippets.

@swlaschin
swlaschin / effective-fsharp.md
Last active March 8, 2024 03:10
Effective F#, tips and tricks

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges

@russss
russss / deskew.py
Created September 10, 2018 12:05
Automatic scanned image rotation/deskew with OpenCV
import cv2
import numpy as np
def deskew(im, max_skew=10):
height, width = im.shape
# Create a grayscale image and denoise it
im_gs = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
im_gs = cv2.fastNlMeansDenoising(im_gs, h=3)
@bigspawn
bigspawn / download-from-facecast.md
Last active January 8, 2024 17:55
How download video from facecast.net
@Daniel-Hug
Daniel-Hug / delegate-event.js
Last active September 14, 2020 05:05
Vanilla JS equivalent of jQuery's .live(): use event delegation to handle events whose target matches a selector, closest(): get nearest parent element matching selector
// get nearest parent element matching selector
var closest = (function() {
var el = HTMLElement.prototype;
var matches = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
return function closest(el, selector) {
return matches.call(el, selector) ? el : closest(el.parentElement, selector);
};
})();
@hsiboy
hsiboy / animation.ino
Created January 9, 2015 16:39
FUNCTION-BASED ANIMATION SEQUENCES FOR WS2812 LED STRIPS Using FastLED library - Author: Dave Morris: http://www.google.com/+DaveMorris128
// FUNCTION-BASED ANIMATION SEQUENCES FOR WS2812 LED STRIPS
// Using FastLED library
// Author: Dave Morris: http://www.google.com/+DaveMorris128
// Version 1.0 (2014-07-31)
//
//
// The following code includes "primitive animations" which are the base effect and
// "aggregate animations" which are combinations of one or more primitive animations
// Feel free to combine different primitives each loop for synergistic results but:
// -If using an aggregate animation make sure your primatives don't clear the buffer each frame (FastLED.clear())
@BestKora
BestKora / EfficientJSON.playground.swift
Last active August 29, 2015 14:07
Код к статье "Эффективный JSON с функциональными концепциями и дженериками в Swift" http://www.bestkora.com/SwiftLearning/effektivnyj-json-v-swift-s-funtsionalnymi-kontseptsiyami-i-dzhenerikami/
// Playground - noun: a place where people can play
import Foundation
/*let parsedJSON : [String:AnyObject] = [
"id": 1,
"name": "Cool User",
"email": "u.cool@example.com"
]
@xeoncross
xeoncross / composer.md
Last active March 26, 2024 02:59
How composer actually works

Composer

the missing quick-start guide

We will assume we have a package/project called https://github.com/foo/bar

Most redistributable packages are hosted on a version control website such as Github or Bitbucket. Version control repositories often have a tagging system where we can define stable versions of our application. For example with git we can use the command:

git tag -a 1.0.0 -m 'First version.'

With this we have created version 1.0.0 of our application. This is a stable release which people can depend on. If we wanted to include "foo/bar" then we could create a composer.json and specify the tagged release we wanted:

@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active March 27, 2024 06:36
A badass list of frontend development resources I collected over time.
@SiriusDely
SiriusDely / push_apns.php
Created May 2, 2012 00:23
Push Notification PHP Script - Apple iOS, Android C2DM, BlackBerry PPG
<?php
// Put your device token here (without spaces):
$deviceToken = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// Put your private key's passphrase here:
$passphrase = 'xxxxxxx';
// Put your alert message here:
$message = 'A push notification has been sent!';