Skip to content

Instantly share code, notes, and snippets.

View ruddfawcett's full-sized avatar

Rudd Fawcett ruddfawcett

View GitHub Profile
@ruddfawcett
ruddfawcett / APIClient+PromiseKit.swift
Created April 30, 2020 23:32 — forked from DanielCardonaRojas/APIClient+PromiseKit.swift
Custom API Client Abstractions inspired by http://kean.github.io/post/api-client but with no third party dependencies. As a lib over here -> https://github.com/DanielCardonaRojas/APIClient
import PromiseKit
extension APIClient {
func request<Response, T>(_ requestConvertible: T,
additionalHeaders headers: [String: String]? = nil,
additionalQuery queryParameters: [String: String]? = nil,
baseUrl: URL? = nil) -> Promise<T.Result>
where T: URLResponseCapable, T: URLRequestConvertible, T.Result == Response {
return Promise { seal in
self.request(requestConvertible, additionalHeaders: headers, additionalQuery: queryParameters, success: { response in
@bnickel
bnickel / Queue Playground.swift
Last active June 23, 2020 16:33
Swift retry operation playground
import Foundation
protocol Completable {
func addCompletionOperation(on queue: OperationQueue, complete: @escaping (Self) -> Void) -> Operation
}
extension Completable where Self: Operation {
func addCompletionOperation(on queue: OperationQueue, complete: @escaping (Self) -> Void) -> Operation {
let completionOperation = BlockOperation {
@graceavery
graceavery / harryPotterAliases
Last active May 10, 2023 02:51
bash aliases for Harry Potter enthusiasts
alias accio=wget
alias avadaKedavra='rm -f'
alias imperio=sudo
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"'
alias stupefy='sleep 5'
alias wingardiumLeviosa=mv
alias sonorus='set -v'
alias quietus='set +v'
@ruddfawcett
ruddfawcett / email-blacklist.json
Last active November 2, 2015 08:28 — forked from tbrianjones/free_email_provider_domains.txt
A list of free email provider domains. Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
["1033edge.com","11mail.com","123.com","123box.net","123india.com","123mail.cl","123qwe.co.uk","150ml.com","15meg4free.com","163.com","1coolplace.com","1freeemail.com","1funplace.com","1internetdrive.com","1mail.net","1me.net","1mum.com","1musicrow.com","1netdrive.com","1nsyncfan.com","1under.com","1webave.com","1webhighway.com","212.com","24horas.com","2911.net","2bmail.co.uk","2d2i.com","2die4.com","3000.it","321media.com","37.com","3ammagazine.com","3dmail.com","3email.com","3xl.net","444.net","4email.com","4email.net","4mg.com","4newyork.com","4x4man.com","5iron.com","5star.com","88.am","8848.net","888.nu","97rock.com","aaamail.zzn.com","aamail.net","aaronkwok.net","abbeyroadlondon.co.uk","abcflash.net","abdulnour.com","aberystwyth.com","abolition-now.com","about.com","academycougars.com","acceso.or.cr","access4less.net","accessgcc.com","ace-of-base.com","acmecity.com","acmemail.net","acninc.net","adelphia.net","adexec.com","adfarrow.com","adios.net","ados.fr","advalvas.be","aeiou.pt","aemail4u.com","aene
@austinzheng
austinzheng / CustomTextInputView.swift
Last active January 20, 2022 15:14
Simple UIKeyInput example
import UIKit
/// A very simple example view that can accept keyboard input and add or delete text from an enclosed label.
class CustomTextInputView : UIControl, UIKeyInput {
var label : UILabel?
override func canBecomeFirstResponder() -> Bool {
return true
}
@zwaldowski
zwaldowski / TextRanges.swift
Last active January 28, 2017 09:50
Proper bridging for NSRegularExpression; Swift 1.2
import Foundation
// MARK: String
extension String {
func convert(#index: Int) -> Index? {
let utfIndex = advance(utf16.startIndex, index, utf16.endIndex)
return utfIndex.samePositionIn(self)
}
@viktorbezdek
viktorbezdek / jade_helper.md
Last active February 16, 2022 18:03
Jade - pass variable to base layout from extending template

layout.jade

doctype 5
html.no-js(lang='en')
block vars
head
  title #{title}
  meta(name='description', content='#{description}')
body
@deandob
deandob / livestream
Created February 26, 2014 22:31
Node.JS function to remux mp4/h.264 video from an IP camera to a HTML5 video tag using FFMPEG
// Live video stream management for HTML5 video. Uses FFMPEG to connect to H.264 camera stream,
// Camera stream is remuxed to a MP4 stream for HTML5 video compatibility and segments are recorded for later playback
var liveStream = function (req, resp) { // handle each client request by instantiating a new FFMPEG instance
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var reqUrl = url.parse(req.url, true)
var cameraName = typeof reqUrl.pathname === "string" ? reqUrl.pathname.substring(1) : undefined;
if (cameraName) {
try {
cameraName = decodeURIComponent(cameraName);
@ruddfawcett
ruddfawcett / octicons.css
Created December 6, 2013 19:29
The @font-face for the GitHub Octicons. See https://github.com/styleguide/css/7.0 for more information.
@font-face {
font-family: 'Octicons';
src: url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.eot?ade8e027");
src: url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.eot?ade8e027#iefix") format("embedded-opentype")
, url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.woff?fca05081") format("woff")
, url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.ttf?b2778fb1") format("truetype")
, url("https://a248.e.akamai.net/assets.github.com/fonts/octicons/octicons-regular-webfont.svg?b5c3b089#newFontRegular") format("svg")
;
font-weight: normal;
font-style: normal;
anonymous
anonymous / jsbin.iciyax.css
Created November 17, 2013 04:28
html {
/* background: url('https://dl.dropbox.com/u/45570283/TinyWings/images/backgroundImage.jpeg') no-repeat center center fixed; */
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
body {
background-color: #EEE;