Skip to content

Instantly share code, notes, and snippets.

View paulspringett's full-sized avatar

Paul Springett paulspringett

  • Leeds, United Kingdom
  • 15:50 (UTC +01:00)
View GitHub Profile
@paulspringett
paulspringett / array_focus.rb
Created October 26, 2012 08:36
Focus on elements in an Array
class Array
# Public: slice Array while focusing on the given item in the array
# and padding around it
#
# item - element in the Array to focus on
# padding - Integer of the number of elements to pad by (default: 2)
#
# Examples:
# items = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t"]
#
@paulspringett
paulspringett / rspec.md
Created November 12, 2012 12:55
RSpec testing resources
# Creating a like
curl -X POST \
http://api.rusic.com/buckets/123/ideas/456/like \
-D "like[should_post_to_social]=true" \
-H "X-API-Key: 8bca8fa86b" \
-H "X-Participant-Token: 19ba7d23ef" \
# Removing a like
curl -X DELETE \
http://api.rusic.com/buckets/123/ideas/456/like \
regex = /^(([a-z0-9\-]+\.)+[a-z]{2,})$/
regex.match('example.org')
=> #<MatchData "example.org"...>
regex.match('nota-hostname')
=> nil
regex.match('sub.example.org')
=> #<MatchData "sub.example.org"...>
### Keybase proof
I hereby claim:
* I am paulspringett on github.
* I am paulspringett (https://keybase.io/paulspringett) on keybase.
* I have a public key whose fingerprint is CA7D E438 060B 4BE7 E82D 044E D9EC 1739 EEEB 5895
To claim this, I am signing this object:
Thu Jan 12 15:21:23 UTC 2017