Skip to content

Instantly share code, notes, and snippets.

View jspahrsummers's full-sized avatar

Justin Spahr-Summers jspahrsummers

View GitHub Profile
In some cases the type of a method's result may depend on the type of its arguments.
To accurately express the signatures of such methods one may use parametric polymorphism.
A parametrically polymorphic method signature introduces one or more formal type arguments
which can be used throughout the signature and the method body. When the message is sent,
the actual types will be inferred and replace the formal type arguments in the signature.
As an example, consider the signature of -[NSArray[T] mapArrayUsingBlock:]
- (NSArray[X]) mapArrayUsingBlock: (X (^)(T obj) block;
The type term X def introduces a type argument X, which will be inferred to be the type returned
@paulmillr
paulmillr / active.md
Last active April 23, 2024 17:32
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@mattpodwysocki
mattpodwysocki / Rx-Implementations.md
Created May 14, 2012 18:19
List of Alternative Implementations of the Reactive Extensions
@prabirshrestha
prabirshrestha / TextFieldChanges.m
Created August 2, 2012 13:53
Reactive Cocoa examples
@synthesize firstName = _firstName;
@synthesize txtFirstName = _txtFirstName;
[RACAbleSelf(self.firstName) subscribeNext:^(id x) { [self firstNameChanged:x]; }];
[self rac_bind:RAC_KEYPATH_SELF(self.firstName) to:self.txtFirstName.rac_textSubscribable];
- (void) firstNameChanged:(id)firstName {
NSLog(@"changed: %@", firstName);
}
@yjsoon
yjsoon / gist:3485271
Created August 27, 2012 03:22
vim search Dash for word under cursor, filetype-specific
" Searches Dash for the word under your cursor in vim, using the keyword
" operator, based on file type. E.g. for JavaScript files, I have it
" configured to search j:term, which immediately brings up the JS doc
" for that keyword. Might need some customisation for your own keywords!
function! SearchDash()
" Some setup
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
@sebfisch
sebfisch / gist:3757918
Created September 20, 2012 19:43
Comparing Snap's and Yesod's Template Languages Heist and Hamlet

Comparing Snap's and Yesod's Template Languages Heist and Hamlet - and HSP

Currently, Snap and Yesod are the two most active web frameworks for Haskell. In this document, I compare the template languages used by those frameworks for generating HTML.

Both template languages let programmers write markup directly in a markup language rather than generating it from within Haskell. Compared with static HMTL, template languages support substitution to dynamically determine parts of the content of the generated page.

[Heist] and [Hamlet] support different constructs to generate content dynamically. They also differ regarding their syntax for static content.

@jwilling
jwilling / gist:4186817
Last active March 5, 2023 22:01
Lets help improve AppKit.

Is AppKit causing you frustration? Instead of just complaining about it, lets try to make it better by compiling a list of specific problems with AppKit. Leave a comment below, and I'll include it in the list.


##NSView##

  • NSView does not have the ability to set an affine transform (rdar://15608609)
  • Controls that have cells (such as NSTextField) do not respond properly when layer-backed. Take NSButton as an example. When not layer-backed, it will animate properly using the animator proxy. When layer-backed, using the animator proxy breaks focus rings (they jump to destination immediately). Currently, directly manipulating the layer of a cell-based control is not supported (and will lead to a broken interface), but is much needed. (rdar://15608822)

##NSViewController##

  • NSViewController could be more useful. It has -loadView but no other lifecycle methods. (rdar://15608948)
public DashboardHostTileView()
{
InitializeComponent();
this.OneWayBind(ViewModel, x => x.Model.Title, x => x.Title.Text);
this.OneWayBind(ViewModel, x => x.UserAndOrgTiles, x => x.UserAndOrgTiles.ItemsSource);
this.BindCommand(ViewModel, x => x.ShowLoginCommand, x => x.ShowLoginCommand);
// Bind SelectedItem of ListBox to the ViewModel
this.WhenAny(x => x.UserAndOrgTiles.SelectedItem, x => x.Value)
{-# LANGUAGE TemplateHaskell, QuasiQuotes #-}
module TestInlineObjC (objc_initialise, dumpURL) where
import Language.C.Quote.ObjC
import InlineObjC
objc_import ["<Foundation/Foundation.h>"]
@technoweenie
technoweenie / gist:5101109
Last active January 7, 2016 16:56
API Existential Crisis

API Existential Crisis

One bit of feedback we've heard from some heavy users of the API is that they want to access user and repository data by ID, and not name.

GET /users/technoweenie
GET /repos/technoweenie/faraday

If you're tracking user or repository data, using a URL with a unique and unchanging ID means the application won't break if the user or repository is