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
| message = text.encode("UTF-16BE").force_encoding("BINARY") | |
| Gateway.send_mt(sender, receiver, message, data_coding: 8) | |
| message = pdu.short_message.force_encoding('UTF-16BE').encode('UTF-8') |
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
| https://gist.github.com/zhengjia/428105 | |
| Class: Capybara::Node::Element | |
| * [] - Retrieve the given attribute | |
| * allow_reload! | |
| * checked? - Whether or not the element is checked. | |
| * click - Click the Element. | |
| * disabled? - Whether or not the element is disabled. | |
| * drag_to(node) - Drag the element to the given other element. |
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
| // First file - git-completion.bash | |
| #!bash | |
| # | |
| # bash/zsh completion support for core Git. | |
| # | |
| # Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
| # Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
| # Distributed under the GNU General Public License, version 2.0. | |
| # |
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
| group :development, :test do | |
| gem 'faker' | |
| gem 'rspec' | |
| gem 'rspec-rails' | |
| end | |
| group :test do | |
| gem 'database_cleaner' | |
| gem 'factory_girl_rails' |
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
| require "timeout" | |
| module WaitForAjax | |
| def self.delay | |
| @delay || 1 | |
| end | |
| def self.delay= val | |
| @delay = val | |
| 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
| $('selector').smartDataInputs() | |
| (($) -> | |
| # e.keyCode e.shiftKey e.ctrlKey e.altKey e.metaKey | |
| # keydown => keypress => keyup | |
| $.fn.smartDataInputs = (options) -> | |
| block = @ | |
| inputs = block.children('input') | |
| params = $.extend {}, options |
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
| # STUB draft | |
| Page.any_instance.stub(:save).and_return(false) | |
| # CREATE draft | |
| page = Page.create! valid_attributes | |
| expect { | |
| delete :destroy, {:id => page.to_param}, valid_session | |
| }.to change(Page, :count).by(-1) |
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
| has_many :attached_images, -> { where(attachment_content_type: "image/jpeg") }, as: :storage, class_name: AttachedFile |
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
| image = MiniMagick::Image.open AttachedFile.last.path | |
| image[:width] | |
| image[:height] | |
| image.auto_orient | |
| image.resize "800x" | |
| image.resize "x600" | |
| image.format "gif" | |
| c.rotate "-90>" | |
| c.gravity "center" | |
| c.compose "Over" # OverCompositeOp |
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
| namespace :db do | |
| namespace :seed do | |
| Dir[File.join(Rails.root, 'db', 'seeds', '*.rb')].each do |seed_file| | |
| task_name = File.basename(seed_file, '.rb').intern | |
| desc "Load the seed data from db/seeds/#{task_name}.rb" |