This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def method | |
| okay | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Kernel | |
| def caller_method_name | |
| parse_caller(caller(2).first).last | |
| end | |
| def parse_caller(at) | |
| if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at | |
| file = Regexp.last_match[1] | |
| line = Regexp.last_match[2].to_i | |
| method = Regexp.last_match[3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def will_this_work | |
| puts "Test" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('form a.add_child').click(function() { | |
| // The link that was clicked on has a data-association attribute that points it to the correct ID to clone. | |
| var association = $(this).attr('data-association'); | |
| // Grab the template of the fields you want to copy, convert it to a string via the html() method | |
| var template = $('#' + association + '_fields_template').html(); | |
| // Create a random number to replace the ID / name | |
| var regexp = new RegExp('new_' + association, 'g'); | |
| var new_id = new Date().getTime(); | |
| // Replace and Insert | |
| $(this).parent().before(template.replace(regexp, new_id)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Here is how I would implement Fizzbuzz with objects | |
| # The main issue with your class is what's called | |
| # single responsibility principle | |
| # classes should do one thing and be about | |
| # instances of those classes | |
| # the fizzbuzz class should be about the loop | |
| # just solving fizzbuzz individually | |
| class Fizzbuzz | |
| attr_accessor :value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Song | |
| attr_accessor :name | |
| @@song_library = [] | |
| def self.all | |
| @@song_library | |
| end | |
| def initialize(name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| matz | |
| kent beck | |
| roy fielding | |
| martin fowler | |
| tim berners lee | |
| david heniemer hansing | |
| john resig | |
| jesse james garret | |
| _why the lucky stiff | |
| marc anderseen |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # License: Public Domain. | |
| # Author: Joseph Wecker, 2012 | |
| # | |
| # Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile? | |
| # Are you tired of trying to remember how darwin/mac-osx treat them differently from linux? | |
| # Are you tired of not having your ~/.bash* stuff work the way you expect? | |
| # | |
| # Symlink all of the following to this file: | |
| # * ~/.bashrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%= f.fields_for :artist do |artist_form| %> | |
| <div class="field"> | |
| <%= artist_form.label :name, 'Artist Name' %><br /> | |
| <%= artist_form.text_field :name %> | |
| </div> | |
| <% end %> |