Skip to content

Instantly share code, notes, and snippets.

View jacklynrose's full-sized avatar

Jacklyn Rose jacklynrose

  • Australia
View GitHub Profile
@jacklynrose
jacklynrose / .zshrc
Last active October 31, 2021 23:57
Generate a branch name with ZSH prompts that has the ticket name and description
# 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'
}

Keybase proof

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:

Keybase proof

I hereby claim:

  • I am watsonhamblin on github.
  • I am fluffyjack (https://keybase.io/fluffyjack) on keybase.
  • I have a public key whose fingerprint is 8203 E7C0 359A 6B05 1787 ED6E C1C5 3A42 6E34 5928

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);
@jacklynrose
jacklynrose / README.md
Last active August 29, 2015 14:13
Using self-invoking closures for tricky mutable dictionary values.

Swift Self-invoking Closures

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.

Profile View

Explaination

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.

@jacklynrose
jacklynrose / motion-kit-love.rb
Created December 18, 2014 10:31
I do love motion-kit
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
@jacklynrose
jacklynrose / ex1.c
Last active August 29, 2015 14:01
Hello {{name}} in C
#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]));
@jacklynrose
jacklynrose / openstruct.rb
Created May 23, 2014 09:55
Half implementation of OpenStruct
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
@jacklynrose
jacklynrose / chooser.rb
Created May 13, 2014 07:46
How my girlfriend and I can make decisions from now on
#!/usr/bin/ruby
puts ARGV.sample
@jacklynrose
jacklynrose / README.md
Last active August 29, 2015 14:01
How I run MiniTest tests in 50% of the time of Rake::TestTask

RESULTS

Rake::TestTask

time rake test
real	0m1.111s
user	0m0.962s
sys	0m0.133s

time rake test