I hereby claim:
- I am rcdilorenzo on github.
- I am rcdilorenzo (https://keybase.io/rcdilorenzo) on keybase.
- I have a public key ASABBZcTLyE8g_vbKklI8aSC1LTqFlK-KHgIaZuKIcm39Qo
To claim this, I am signing this object:
package main | |
import ( | |
"fmt" | |
"math" | |
"sort" | |
) | |
type Recommendation struct { | |
Name string |
I hereby claim:
To claim this, I am signing this object:
// Requires a property like the following | |
// @property (nonatomic, strong) UIPopoverController *textPopover; | |
- (void)displayPopoverForText:(NSString *)text inView:(UIView *)view presentingRect:(CGRect)rect maxSize:(CGSize)maxSize { | |
UIViewController *controller = [UIViewController new]; | |
UITextView *textView = [UITextView new]; | |
textView.text = text; | |
textView.editable = NO; | |
textView.backgroundColor = [UIColor clearColor]; |
TIL: Apparently, Swift does not support creating concrete protocols from generic ones since it uses associated types for more customizable generic protocol adaptation. This is in contrast to classes and structs. Here is an example of a generic struct from my situation:
fileprivate struct WindowScopeUpdate<State> {
let update: (State) -> (State)
}
An example usage would be like this (where TaskListWindowState
is a concrete type such as a class, struct, or non-generic protocol):
#import <Foundation/Foundation.h> | |
typedef BOOL(^NSArrayDiffMatch)(id _Nonnull original, id _Nonnull comparedTo); | |
@interface NSArrayDiff : NSObject | |
+ (instancetype _Nonnull)newWithOriginal:(NSArray * _Nonnull)original | |
diffedAgainst:(NSArray * _Nonnull)compareTo | |
match:(NSArrayDiffMatch _Nonnull)match; |
-module(calculator). | |
-export([sum/1, sum/2, factorial/1, factorial/2]). | |
sum(N) when N > 0 -> | |
sum(N, 0). | |
sum(N, Current) when N > 0 -> | |
sum(N-1, Current+N); | |
sum(0, Current) -> |
defmodule Duration do | |
@moduledoc """ | |
This duration module parses and formats strings | |
for a time duration in hours and minutes and | |
optionally seconds (e.g. 01:00 for an hour, | |
00:01:10 for one minute and ten seconds). | |
""" | |
@match ~r/^(?<hour>\d{1,2}):(?<min>\d{1,2}):?(?<sec>\d{0,2})$/ | |
def parse(string) do |
; Description: | |
; This program demonstrates how to | |
; create a while-style loop with the | |
; condition either above or below | |
; the block of code to execute. | |
; Author: Christian Di Lorenzo | |
INCLUDE Irvine32.inc |
--- | |
- hosts: all | |
remote_user: pi | |
tasks: | |
- name: check if erlang installed | |
shell: which erl | |
register: erl_check | |
ignore_errors: true | |
- apt_repository: repo='deb http://packages.erlang-solutions.com/debian wheezy contrib' state=present |