Skip to content

Instantly share code, notes, and snippets.

View carlosmcevilly's full-sized avatar

Carlos McEvilly carlosmcevilly

View GitHub Profile
@carlosmcevilly
carlosmcevilly / elshirt.pl
Created March 5, 2016 04:42
El Shirt snake oil crypto submission
#!/usr/bin/perl -T # use -T because it makes things secure
use strict;
use warnings;
# El Shirt key preparation algorithm
#
# El Shirt is an anagram of SLITHER
#
# **** Background ****
@carlosmcevilly
carlosmcevilly / hamming-ball.py
Last active July 11, 2017 14:55
Playing with the idea of a Hamming ball. This calculates the Hamming ball starting at a given number, with given number of bits and given radius.
#!/usr/bin/env python3
# What is a hamming ball?
#
# I couldn't find any definition for it on the Internets. But reading between the lines
# of what people in the know say, I'll take a stab at a preliminary definition. Don't
# trust this... I haven't studied it and am not a mathematician. Having said that,
# It seems to be the set of all numbers having the same number of bits as a starting
# number (the center) and differing from that number by at most (radius) bits. The
# code below assumes the starting number is also included, but I haven't confirmed
@carlosmcevilly
carlosmcevilly / UITextField-Navigation.swift
Created June 5, 2015 17:27
First cut at associated objects in Swift for keeping track of next and previous field in a form
import ObjectiveC
var nextHashKey: UInt8 = 0
var prevHashKey: UInt8 = 0
extension UITextField {
var nextTextField:UITextField {
get {
return objc_getAssociatedObject(self, &nextHashKey) as! UITextField
}
@carlosmcevilly
carlosmcevilly / hex2uicolor
Created April 26, 2015 17:24
Generate UIColor code and related images from a hex color RGB string
#!/usr/bin/perl
# hex2uicolor by Carlos McEvilly
use strict;
use warnings;
my ($r,$g,$b) = @ARGV;
die "\nusage: $0 <red> <green> <blue>\n\n" .
@carlosmcevilly
carlosmcevilly / make-icon-sizes.sh
Last active March 7, 2016 05:41
Generate sized icons for iOS and Watch development using ImageMagick convert
#!/bin/bash
# IMPORTANT: the default options for convert might not give you the
# same quality you will get from Gimp or Photoshop. You might have
# to dig into the convert command line options and tweak them to
# suit what kind of conversion you want. Someday I will do that...
# for now this script is best used for making test icon suites.
# requires ImageMagick for the 'convert' command below.
# http://www.imagemagick.org or on OS X: brew install imagemagick
@carlosmcevilly
carlosmcevilly / gist:cb77c2331824bfbadd09
Last active August 29, 2015 14:18
Category method for NSString to send current string to pasteboard as plain UTF8 text
/**
Put this in a category on NSString, then use as:
[myString sendToPasteboard];
**/
- (void)sendToPasteboard {
NSDictionary *dict = @{ @"public.utf8-plain-text" : self };
UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard];
pasteBoard.items = @[ dict ];
#!/bin/bash
#
# Using the information available in the new iOS8 simulator for each
# device/runtime (device.plist), this script creates a readable folder structure
# (no UDIDs, just simple device/runtime names). Inside that structure it creates
# soft links to your apps in development.
#
# You can run this script every time you install an app to your simulator, or
# you can simply call it to access this folder making sure it will always be
# updated :)
@carlosmcevilly
carlosmcevilly / make-ios-ovpn.pl
Created January 7, 2015 17:46
Given a .pfx and .ovpn file pair, create a new .ovpn file with the key and certs inline, suitable for use with the OpenVPN iOS app.
#!/usr/bin/perl
use strict;
use warnings;
# $Id: make-ios-ovpn.pl,v 0.0 2015/01/07 06:18:40 carlos Exp $
my ($pfxfile, $ovpnfile, $out, $rest) = @ARGV;
error_exit("usage: $0 <pfxfile> <ovpnfile> <out>")
unless (defined($out) && !defined($rest));

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

Keybase proof

I hereby claim:

  • I am carlosmcevilly on github.
  • I am carlosity (https://keybase.io/carlosity) on keybase.
  • I have a public key whose fingerprint is 213E 95F2 2CBD C8CD BB12 7E63 015F D971 F9D6 B7C7

To claim this, I am signing this object: