Skip to content

Instantly share code, notes, and snippets.

internal let DEFAULT_MIME_TYPE = "application/octet-stream"
internal let mimeTypes = [
"html": "text/html",
"htm": "text/html",
"shtml": "text/html",
"css": "text/css",
"xml": "text/xml",
"gif": "image/gif",
"jpeg": "image/jpeg",
@alsingr
alsingr / Alert.swift
Created September 20, 2018 14:21 — forked from mono0926/Alert.swift
Protocol OrientedなRxSwift化したUIAlertController
import Foundation
import RxSwift
private func getAllEnumValues<T: Hashable>(_: T.Type) -> [T] {
var i = 0
let iterator = AnyIterator<T> {
let next = withUnsafeBytes(of: &i) { $0.load(as: T.self) }
if next.hashValue != i { return nil }
i += 1
return next
@alsingr
alsingr / FadeScrollView.swift
Created July 2, 2018 08:58 — forked from luismachado/FadeScrollView.swift
Custom UIScrollView with fade effect
//
// FadeScrollView.swift
//
// Created by Luís Machado on 23/06/2017.
// Copyright © 2017 Luis Machado. All rights reserved.
//
import UIKit
class FadeScrollView: UIScrollView, UIScrollViewDelegate {
@alsingr
alsingr / UIScrollView+Parallax.swift
Created July 2, 2018 08:44 — forked from valeriomazzeo/UIScrollView+Parallax.swift
Add parallax effect to any scrollview subview
//
// UIScrollView+Parallax.swift
// Parallax
//
// Created by Valerio Mazzeo on 20/05/2016.
// Copyright © 2016 Valerio Mazzeo. All rights reserved.
//
import UIKit
@alsingr
alsingr / querystring.swift
Created April 10, 2018 12:37 — forked from gillesdemey/querystring.swift
Retrieve specific query string parameter from NSURL
func getQueryStringParameter(url: String, param: String) -> String? {
let url = NSURLComponents(string: url)!
return
(url.queryItems? as [NSURLQueryItem])
.filter({ (item) in item.name == param }).first?
.value()
}
mongoose = require('mongoose');
var GridStore = mongoose.mongo.GridStore,
Grid = mongoose.mongo.Grid,
ObjectID = mongoose.mongo.BSONPure.ObjectID;
exports.getGridFile = function(id, fn) {
var db = mongoose.connection.db,
id = new ObjectID(id),