I hereby claim:
- I am jacklynrose on github.
- I am jacklynrose (https://keybase.io/jacklynrose) on keybase.
- I have a public key ASAGELIJ_qqqVpzqBdWg5tf1du-j18KPnIc-DXiKOkOzYAo
To claim this, I am signing this object:
| # Other zushy stuff | |
| sluggify() { | |
| # 1. Convert upper to lower | |
| # 2. Remove all non-alphanumeric chars or non-space char | |
| # 3. Convert spaces to dashes | |
| # 4. Convert multiple dashes to single dash | |
| echo $1 | tr '[:upper:]' '[:lower:]' | tr -dc '[:alnum:] ' | tr '[:space:]' '-' | sed -E 's/-+/-/g' | |
| } |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| // Set on window | |
| this.foobar = "V1" | |
| //=> (result) "V1" | |
| console.log(this.foobar) | |
| //=> (output) V1 | |
| //=> (result) undefined | |
| // Uses window | |
| (() => { | |
| console.log(this.foobar); |
While working on the iOS Development with Swift book I decided on this code for an example I'm using in the chapter that talks about composing views together. This is a silly little scroll view that displays a user's bio, and is actually used by a ProfileView that contains this and a UserDetailsView.
On line 19 I'm creating the setter for the text property that basically is meant to act as a way to apply default attributes to a plain string and assign it to the bio label's attributedText property.
| class ProfileLayout < MotionKit::Layout | |
| def layout | |
| add UIImageView, :profile_image | |
| add UILabel, :name_label | |
| add UILabel, :bio_label | |
| background_color UIColor.whiteColor | |
| end | |
| def profile_image_style |
| #include <stdio.h> | |
| #include <string.h> | |
| int main(int argc, char *argv[]) | |
| { | |
| char hello[80]; | |
| strcpy(hello, "Hello "); | |
| if (argc > 1) | |
| { | |
| puts(strcat(hello, argv[1])); |
| class OpenStruct < BasicObject | |
| def initialize(hash) | |
| @struct = ::Struct.new(*hash.keys.map { |k| k.to_sym }) | |
| @struct = @struct.new(*hash.values) | |
| end | |
| def ==(other) | |
| to_h == other.to_h | |
| end |
| #!/usr/bin/ruby | |
| puts ARGV.sample |
RESULTS
Rake::TestTask
time rake test
real 0m1.111s
user 0m0.962s
sys 0m0.133s
time rake test