Skip to content

Instantly share code, notes, and snippets.

View flanger001's full-sized avatar
🧱

David Shaffer flanger001

🧱
View GitHub Profile
class String
def rotate_vowels(num = 1)
vowels = "aeiou"
uc_vowels = vowels.upcase
tr(uc_vowels, uc_vowels.chars.rotate(num).join).tr(vowels, vowels.chars.rotate(num).join)
end
end
str = "Hey, I'm gonna need you to come in on Saturday."
str.rotate_vowels
def caesar(key, text)
az = ('A'..'Z').to_a
rt = az.rotate(key)
chars = text.split('')
.select { |c| az.include?(c) }
.map { |c| rt[az.index(c)] }
.join('')
end
@flanger001
flanger001 / php_net_easter_eggs.txt
Last active May 27, 2016 13:39
PHP.net keyboard shortcuts/easter eggs
up up down down left right left right b a [enter]
?
esc
j
k
G
g h
g g
g p
g n
@flanger001
flanger001 / is_what_percent_of.rb
Created May 24, 2016 19:19
If you need to know what percentage one number is of another number
# Maybe not the worst monkey patch ever, but don't do this
class Numeric
def is_what_percent_of(num)
100 * (self.to_f/num)
end
end

Spicy Chicken Soup

Ingredients

  • 2 quarts water
  • 8 skinless, boneless chicken breast halves
  • 1/2 teaspoon salt
  • 1 teaspoon ground black pepper
  • 1 teaspoon garlic powder
  • 2 tablespoons dried parsley
<!DOCTYPE html>
<html ng-app='myApp'>
<head>
<title>Angular</title>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js'></script>
<script>
angular.module('myApp', [])
.controller('Person', function($scope) {
var data = {
name: 'John Smith',
@flanger001
flanger001 / springer-free-maths-books.md
Created December 29, 2015 14:06 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of books available for free, here are the direct links
@flanger001
flanger001 / Fan Mail.md
Last active January 23, 2017 03:01
This is my bucket list that I accidentally wrote one day. I say "accidentally" because I didn't set out to write a bucket list, that's just what it became.
  • Mark Hamill - P.O. Box 287, Grand Blanc, MI 48480, USA
  • Harrison Ford - P.O. Box 49344, Los Angeles, CA 90049-0344, USA
  • Dave Grohl -
  • Josh Freese - Rebel Waltz, Inc., 31652 2nd Avenue, Laguna Beach, CA 92651, USA
  • Tom Hanks - Playtone, P.O. Box 7340, Santa Monica, CA 90406-7340, USA
  • Bill Murray - Ziffren, Brittenham, 1801 Century Park West, Los Angeles, CA 90067-6406, USA
  • Dan Akroyd - Applied Action Research Corp., 859 Hollywood Way, Box 497, Burbank, CA 91505, USA
  • John Cleese - Phil McIntyre Management Ltd., 3rd Floor, 85 Newman Street, London, W1T 3EU, UK
@flanger001
flanger001 / application.rb
Last active October 14, 2015 13:00
Dynamic error pages in Rails with testing
# in configure block
config.exceptions_app = self.routes