This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.
— Erik
| # or simply: | |
| 'foobar'.tr 'A-Za-z','N-ZA-Mn-za-m' | |
| # rot(x) | |
| class String | |
| def rot(num = 13) | |
| return self.split("").collect { |ch| | |
| if /^[a-z]$/ === ch | |
| ((ch[0] + num - 'a'[0]) % 26 + 'a'[0]).chr |
| package main | |
| import ( | |
| "crypto/tls" | |
| "crypto/x509" | |
| "fmt" | |
| "io" | |
| "log" | |
| ) |
| package main | |
| import ( | |
| "bytes" | |
| "encoding/hex" | |
| "flag" | |
| "fmt" | |
| "io" | |
| "log" | |
| "net" |
| /* | |
| A Goroutine safe pattern using channels that abstracts away the channels | |
| This is a concept of creating a goroutine safe object that uses channels under the covers to communicate | |
| with the internal map[string]string structure. I know that typically this kind of solution may done | |
| with mutexes but the excercise was in using channels on purpose although they are heavier. | |
| Note a couple of points: | |
| - When using channels, you can still build a public-facing api that nicely abstracts them away, therefore |
| ] wc -l domains.txt | |
| 783 domains.txt | |
| ] time go run domain_lookup_parallel.go | |
| real 0m5.743s | |
| user 0m0.359s | |
| sys 0m0.355s | |
| ] time go run domain_lookup_sequential.go |
| // A small SSH daemon providing bash sessions | |
| // | |
| // Server: | |
| // cd my/new/dir/ | |
| // #generate server keypair | |
| // ssh-keygen -t rsa | |
| // go get -v . | |
| // go run sshd.go | |
| // | |
| // Client: |
| // A small SSH daemon providing bash sessions | |
| // | |
| // Server: | |
| // cd my/new/dir/ | |
| // #generate server keypair | |
| // ssh-keygen -t rsa | |
| // go get -v . | |
| // go run sshd.go | |
| // | |
| // Client: |
| #!/bin/bash | |
| #force run with bash | |
| if [ -z "$BASH_VERSION" ] | |
| then | |
| exec bash "$0" "$@" | |
| return | |
| fi | |
| #create local scope |
| #!/usr/bin/ruby | |
| # encoding: utf-8 | |
| # Copyright (c) 2011, Franz Bettag <franz@bett.ag> | |
| # All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions are met: | |
| # * Redistributions of source code must retain the above copyright | |
| # notice, this list of conditions and the following disclaimer. |