Skip to content

Instantly share code, notes, and snippets.

View Epyon616's full-sized avatar

Lee Richmond Epyon616

  • Leeds, Yorkshire, United Kingdom
  • 18:07 (UTC -12:00)
View GitHub Profile
@Epyon616
Epyon616 / fizzbuzz.rb
Last active July 24, 2018 14:03
Decided to see if I could solve the age old fizz buzz test, it's probably not the most concise solution and its definitely not finished but it is at least readable
#!/usr/bin/env ruby
number_array = [*1..100]
def divisible_by(divisible, number)
number.modulo(divisible).zero?
end
number_array.each do |num|
puts "fizz buzz" if (divisible_by(3, num) && divisible_by(5, num))
@Epyon616
Epyon616 / Preferences.sublime-settings
Created December 10, 2013 09:48
My Sublime Text config
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 50,
"auto_complete_selector": "source - comment",
"auto_complete_size_limit": 4194304,
"auto_complete_triggers":
[
{
"characters": "<",
@Epyon616
Epyon616 / Tunes.js
Created August 1, 2013 19:08
gist form peepcode tutorial work
(function($) {
window.Album = Backbone.Model.extend({
isFirstTrack: function(index) {
return index == 0;
},
isLastTrack: function(index) {
return index >= this.get('tracks').length - 1;
},
@Epyon616
Epyon616 / truncating text
Created November 22, 2010 09:33
a quick way of truncating text in Ruby
def truncate_words(text, url, length = 120, end_string = "... <a href='#{url}' class='more'>read more <img src='/images/black/arrow_right_8x8.png' /></a>")
words = text.split()
words[0..(length-1)].join(' ') + (words.length > length ? end_string : '')
end