Slide 1

Slide 1 text

Eugene Kenny @eugeneius Developer toolbox Six development tools that will give you fabulous secret powers

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Technology on Adverts.ie • Graphite for stats and graphs • Varnish for load balancing, Pound for SSL • Composer for PHP dependencies

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

What I look at all day

Slide 7

Slide 7 text

Technology on some other site

Slide 8

Slide 8 text

What I would look at all day

Slide 9

Slide 9 text

What am I going to talk about? Overview of 6 tools (Boris, HTTPie, jq, terminator, MailCatcher and boom) Assumption: you work on either Linux or OS X, use the command line

Slide 10

Slide 10 text

Tool #1: Boris git clone git://github.com/d11wtq/boris.git boris/bin/boris Setup:

Slide 11

Slide 11 text

JavaScript console is a REPL

Slide 12

Slide 12 text

REPL: a big loop

Slide 13

Slide 13 text

php -a vs Boris > php -a php > $arr = ["Hello", "World"]; php > var_dump($arr); array(2) { [0]=> string(5) => "Hello" [1]=> string(5) => "World" } php > $arr[1] = "PHP" php > var_dump($arr); array(2) { [0]=> string(5) "Hello" [1]=> string(3) => "PHP" }

Slide 14

Slide 14 text

php -a vs Boris > boris/bin/boris boris> $arr = ["Hello", "World"]; array(2) { [0]=> string(5) "Hello" [1]=> string(5) "World" } boris> $arr[1] = "Boris"; array(2) { [0]=> string(5) "Hello" [1]=> string(5) "Boris" }

Slide 15

Slide 15 text

Loading your environment > boris -r bootstrap.php boris> $user = new User(); !object(User)#8 (1) { ["username"]=> NULL } boris> $user->username = "eugeneius" !string(9) "eugeneius" boris> $user !object(User)#8 (1) { ["username"]=> string(9) "eugeneius" }

Slide 16

Slide 16 text

Other nice features: • Remembers your command history • Will load .borisrc file in your home directory, which can contain arbitrary PHP code to run at startup • You can implement a custom Inspector, to control how values are printed

Slide 17

Slide 17 text

Tool #2: HTTPie sudo apt-get install python-pip pip install httpie Setup:

Slide 18

Slide 18 text

curl -X POST http://example.com \ -d arg=val -d foo=bar \ -H X-Api-Key:a0b0c0 \ -H X-Custom-Header:whatever http POST http://example.com \ arg=val foo=bar \ X-Api-Key:a0b0c0 \ X-Custom-Header:whatever HTTPie vs cURL

Slide 19

Slide 19 text

curl -X POST http://example.com -F arg=val -F [email protected] http POST http://example.com arg=val [email protected] Uploading files http PUT http://example.com < lolcat.jpg curl -X PUT http://example.com -T [email protected]

Slide 20

Slide 20 text

> curl http://api.tumblr.com/v2/blog/wheningit.tumblr.com/posts? api_key=fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4 {"meta":{"status":200,"msg":"OK"},"response":{"blog": {"title":"When in git","name":"wheningit","posts": 49,"url":"http:\/\/wheningit.tumblr.com\/","updated": 1364229309,"description":"Remember that time using git when... Brought to you by @kylerush and @creighfishtaco.","ask":false,"ask_anon":false,"is_nsfw":false," share_likes":true,"likes":0},"posts": [{"blog_name":"wheningit","id":46258279610,"post_url":"http:\/\/ wheningit.tumblr.com\/post\/46258279610\/when-i-discovered-what- the-porcelain-flag-did-on-git","slug":"when-i-discovered-what- the-porcelain-flag-did-on-git","type":"text","date":"2013-03-25 16:35:09 GMT","timestamp": 1364229309,"state":"published","format":"html","reblog_key":"goC oFPdn","tags":[],"short_url":"http:\/\/tmblr.co\/ Zt8S7vh5DLIw","highlighted":[],"note_count":10,"title":"When I Fetching JSON with cURL

Slide 21

Slide 21 text

Fetching JSON with HTTPie > http http://api.tumblr.com/v2/blog/wheningit.tumblr.com/posts? api_key=fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4 { "meta": { "status": 200, "msg": "OK" }, "response": { "blog": { "title": "When in git", "name": "wheningit", "posts": 49, "url": "http://wheningit.tumblr.com", "updated": 1364229309, "description": "Remember that time using git when... Brought to you by @kylerush and @creighfishtaco.", "ask": false,

Slide 22

Slide 22 text

Tool #3: jq curl -O http://stedolan.github.io/jq/download/linux64/jq chmod +x jq sudo mv jq /usr/local/bin Setup:

Slide 23

Slide 23 text

Tool #3: jq curl -O http://stedolan.github.io/jq/download/linux64/jq http --download http://stedolan.github.io/jq/download/linux64/jq chmod +x jq sudo mv jq /usr/local/bin Setup:

Slide 24

Slide 24 text

Tool #3: jq curl -O http://stedolan.github.io/jq/download/linux64/jq http --download http://stedolan.github.io/jq/download/linux64/jq chmod +x jq sudo mv jq /usr/local/bin Setup:

Slide 25

Slide 25 text

jq parses JSON > echo '{"key":"value"}' | jq '.key' "value" > echo '["one", "two", "three"]' | jq '.[]' "one" "two" "three" > echo '[1, 2, 3]' | jq 'add' 6 > echo '{"apples": 10, "pears": 13}' | jq '[.[]] | add' 23

Slide 26

Slide 26 text

Pipe output from HTTPie > http https://api.github.com/users/eugeneius/repos [ { "id": 3127875, "name": "boom", "full_name": "eugeneius/boom", "owner": { "login": "eugeneius", "id" 432189, "url": "https://api.github.com/users/eugeneius", "html_url": "https://github.com/users/eugeneius", ... }, private: false, html_url: "https://github.com/eugeneius/boom", url: "https://api.github.com/eugeneius/boom", ... } ... ]

Slide 27

Slide 27 text

Pipe output from HTTPie > http https://api.github.com/users/eugeneius/repos \ | jq '.[].html_url' "https://github.com/eugeneius/boom" "https://github.com/eugeneius/jquery-onetime" "https://github.com/eugeneius/PHP-Xero" "https://github.com/eugeneius/URLShortener"

Slide 28

Slide 28 text

Pipe output from HTTPie > http https://api.github.com/users/eugeneius/repos \ | jq '.[].html_url' "https://github.com/eugeneius/boom" "https://github.com/eugeneius/jquery-onetime" "https://github.com/eugeneius/PHP-Xero" "https://github.com/eugeneius/URLShortener" > http https://api.github.com/users/eugeneius/repos \ | jq '.[].html_url' | xargs -l xdg-open

Slide 29

Slide 29 text

Pipe output from HTTPie > http https://api.github.com/users/eugeneius/repos \ | jq '.[].html_url' "https://github.com/eugeneius/boom" "https://github.com/eugeneius/jquery-onetime" "https://github.com/eugeneius/PHP-Xero" "https://github.com/eugeneius/URLShortener" > http https://api.github.com/users/eugeneius/repos \ | jq '.[].html_url' | xargs -l xdg-open

Slide 30

Slide 30 text

Tool #4: Terminator sudo apt-get install terminator Setup:

Slide 31

Slide 31 text

Multiple terminals

Slide 32

Slide 32 text

Saved layouts [layouts] [[production]] [[[window1]]] type = Window size = 1920, 1028 [[[split1]]] type = HPaned position = 960 parent = window1 [[[terminal1]]] type = Terminal parent = split1 command = ssh www1 [[[terminal2]]] type = Terminal parent = split1 command = ssh www2 ...

Slide 33

Slide 33 text

`terminator -l production`

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

Tool #5: MailCatcher sudo apt-get install ruby sudo apt-get install libsqlite3-dev sudo gem install mailcatcher mailcatcher Setup:

Slide 36

Slide 36 text

SMTP How MailCatcher works sendmail Internet ! Internet ! catchmail SMTP:1025

Slide 37

Slide 37 text

> boris/bin/boris boris> $to = "[email protected]"; !string(15) "[email protected]" boris> $subject = "MailCatcher test"; !string(16) "MailCatcher test" boris> $message = "This message should go to MailCatcher"; !string(37) "This message should go to MailCatcher" boris> $headers = "From: [email protected]"; !string(23) "From: [email protected]" boris> mail($to, $subject, $message, $headers); !bool(true) Send a test mail with boris

Slide 38

Slide 38 text

MailCatcher - view message

Slide 39

Slide 39 text

MailCatcher - view source

Slide 40

Slide 40 text

Tool #6: Boom sudo apt-get install ruby sudo gem install boom sudo apt-get install xclip Setup:

Slide 41

Slide 41 text

> boom urls Boom! Created a new list called urls. > boom urls github https://github.com Boom! github in urls is https://github.com. Got it. > boom urls adverts http://www.adverts.ie Boom! adverts in urls is http://www.adverts.ie. Got it. > boom adverts Boom! We just copied http://www.adverts.ie to your clipboard. Boom is a key-value store

Slide 42

Slide 42 text

{ "lists": [ "urls": [ {"github": "https://github.com"}, {"adverts": "http://www.adverts.ie"}, ... ], "gifs": [ {"homerthink":"http://i.imgur.com/25J7e.gif"}, {"slothshades":"http://i.imgur.com/IHcRs.gif"}, ... ] } Data is stored in ~/.boom

Slide 43

Slide 43 text

> boom temp clipboard "http://bit.ly/errhcw" Boom! clipboard in temp is http://bit.ly/errhcw. Got it. Dropbox for copy and paste On computer 1: > boom clipboard Boom! We just copied http://bit.ly/errhcw to your clipboard. On computer 2: Dropbox syncs ~/.boom

Slide 44

Slide 44 text

> boom cmds gitlocalmerged Boom! We just copied git branch --merged master | grep -v 'master' | sed 's/ *//;' | tr '\n' ' ' | sed 's/^/git branch -d /' | sh to your clipboard. > git branch --merged [...] Deleted branch move_newsletter_scripts (was 81b0f8d) Deleted branch initialise_arrays (was 23945fe) ... Store common commands > boom echo gitlocalmerged | sh Deleted branch move_newsletter_scripts (was 81b0f8d) Deleted branch initialise_arrays (was 23945fe) ... Or:

Slide 45

Slide 45 text

> boom cmds gitlocalmerged Boom! We just copied git branch --merged master | grep -v 'master' | sed 's/ *//;' | tr '\n' ' ' | sed 's/^/git branch -d /' | sh to your clipboard. > git branch --merged [...] Deleted branch move_newsletter_scripts (was 81b0f8d) Deleted branch initialise_arrays (was 23945fe) ... Store common commands > boom echo gitlocalmerged | sh Deleted branch move_newsletter_scripts (was 81b0f8d) Deleted branch initialise_arrays (was 23945fe) ... Or:

Slide 46

Slide 46 text

> boom open gifs slothshades Boom! We just opened http://i.imgur.com/IHcRs.gif for you. Open a value in a browser

Slide 47

Slide 47 text

> boom open gifs slothshades Boom! We just opened http://i.imgur.com/IHcRs.gif for you. Open a value in a browser

Slide 48

Slide 48 text

> boom random gifs Boom! We just opened http://i.imgur.com/8QmIp.gif for you. Open a random value

Slide 49

Slide 49 text

> boom random gifs Boom! We just opened http://i.imgur.com/8QmIp.gif for you. Open a random value

Slide 50

Slide 50 text

Can we put them all together?

Slide 51

Slide 51 text

Can we put them all together? No. I'm not MacGyver.

Slide 52

Slide 52 text

Can we put them all together? No. I'm not MacGyver. But separately, these tools can each make you more productive.

Slide 53

Slide 53 text

Can we put them all together? No. I'm not MacGyver. But separately, these tools can each make you more productive. Together, they can make you a LOT more productive.

Slide 54

Slide 54 text

Questions? Even better: any tools I missed?