• This repository has been archived on 25/Jan/2019
  • Stars
    star
    1,465
  • Rank 32,103 (Top 0.7 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 12 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A DSL for Data Manipulation

Underscore.m

About Underscore.m

Underscore.m is a small utility library to facilitate working with common data structures in Objective-C.
It tries to encourage chaining by eschewing the square bracket]]]]]].
It is inspired by the awesome underscore.js.

Real world example

// First, let's compose a twitter search request
NSURL *twitterSearch = [NSURL URLWithString:@"http://search.twitter.com/search.json?q=@SoundCloud&rpp=100"];

// ... then we fetch us some json ...
NSData *data = [NSData dataWithContentsOfURL:twitterSearch];

// ... and parse it.
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data
                                                     options:kNilOptions
                                                       error:NULL];

// This is where the fun starts!
NSArray *tweets = [json valueForKey:@"results"];

NSArray *processed = _array(tweets)
    // Let's make sure that we only operate on NSDictionaries, you never
    // know with these APIs ;-)
    .filter(Underscore.isDictionary)
    // Remove all tweets that are in English
    .reject(^BOOL (NSDictionary *tweet) {
        return [[tweet valueForKey:@"iso_language_code"] isEqualToString:@"en"];
    })
    // Create a simple string representation for every tweet
    .map(^NSString *(NSDictionary *tweet) {
        NSString *name = [tweet valueForKey:@"from_user_name"];
        NSString *text = [tweet valueForKey:@"text"];

        return [NSString stringWithFormat:@"%@: %@", name, text];
    })
    .unwrap;

Documentation

Documentation for Underscore.m can be found on the website.

More Repositories

1

Cartography

A declarative Auto Layout DSL for Swift 📱📐
Swift
7,338
star
2

hamburger-button

A hamburger button transition
Swift
2,308
star
3

RBBAnimation

Block-based animations made easy, comes with easing functions and a CASpringAnimation replacement.
Objective-C
2,061
star
4

FLXView

A UIView that uses Flexbox for layouting. ✨
Objective-C
481
star
5

Swim

A DSL for writing HTML in Swift
Swift
310
star
6

Asterism

Asterism is yet another functional toolbelt for Objective-C. It tries to be typesafe and simple.
Objective-C
226
star
7

RBBJSON

Flexible JSON traversal for rapid prototyping.
Swift
164
star
8

Fantastical-Alfred-Workflow

A simple Alfred 2 workflow for Fantastical.
158
star
9

NES.swift

An NES emulator written in Swift
Swift
149
star
10

dotfiles

Dotfiles to make computing personal.
Shell
87
star
11

Stubbilino

Simple stubbing for Objective-C
Objective-C
86
star
12

swamp

icon stamping in Swift
Swift
85
star
13

Peel-Off-Animation-Example-Code

Example code for https://robb.is/working-on/a-peel-off-animation
Swift
62
star
14

Monocle

Pretty much only a Lens
Swift
45
star
15

ShaderBugs

Some isssues I ran into with SwiftUI.Shader
Swift
36
star
16

robb.swift

My personal website ported to Swift
Swift
34
star
17

Xcode-Configurations

Useful tweaks to Xcode
Objective-C
30
star
18

jekyll-embedly-client

No longer maintained
Ruby
23
star
19

URLRequest-AWS

An extension on URLRequest to sign it for AWS.
Swift
20
star
20

Marbleo.us

A marbleous project
CoffeeScript
18
star
21

Digitale-Zivilgesellschaft

Recommendations from multiple civil society organisations that fight for independent digital infrastructure and open access to knowledge.
HTML
11
star
22

laughing-man

The Laughing Man logo implemented in pure HTML/CSS
6
star
23

monome.js

A library for writing monome apps with node.js
C++
5
star
24

slang

The pxl effect in the browser
CoffeeScript
4
star
25

spinamp

Winamp inside Spotify – it really whips the moose's ass
CoffeeScript
2
star
26

FeedImporter

Import RSS feeds into SoundCloud
Ruby
1
star
27

thedickensbar.com

Put a Dickensbar on top of every page. Lost all its meaning now that the dickbar is gone…
CSS
1
star
28

6strings

Guitar synthesis in the browser!
CoffeeScript
1
star
29

Future

A simple, cold Future.
Swift
1
star