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
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p' | |
| } | |
| COLOR_DEF='%f' | |
| COLOR_USR='%F{243}' | |
| COLOR_DIR='%F{197}' | |
| COLOR_GIT='%F{39}' | |
| NEWLINE=$'\n' | |
| setopt PROMPT_SUBST | |
| export PROMPT='${COLOR_DIR}%d ${COLOR_GIT}$(parse_git_branch)${COLOR_DEF}${NEWLINE}%% ' |
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.govuk_date_field :some_date, | |
| legend: { text: t(".some_date", count: ordinal_number(@dose)), size: 's' }, | |
| hint_text: t('hint_texts.date', date_example: 1.week.ago.strftime('%d %m %Y')), | |
| pre_fill_day: params.dig(:form_model, 'some_date(3i)'), | |
| pre_fill_month: params.dig(:form_model, 'some_date(2i)'), | |
| pre_fill_year: params.dig(:form_model, 'some_date(1i)') | |
| %> | |
| # /lib/extensions/gov_uk_design_system_form_builder |
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
| provider "cloudfoundry" { | |
| api_url = var.api_url | |
| user = var.user | |
| password = var.password | |
| } | |
| terraform { | |
| required_version = ">= 0.13.4" | |
| required_providers { | |
| cloudfoundry = { | |
| source = "cloudfoundry-community/cloudfoundry" |
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
| #puts VCR.current_cassette.http_interactions.interactions.last.response.to_hash["body"] | |
| #thing = YAML.load_file(VCR.current_cassette.file) | |
| #puts thing["http_interactions"].last["response"]["body"]["string"].class |
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 OverseasCandidate < Base | |
| attribute :telephone_number, :string | |
| attribute :callback_date, :date | |
| attribute "callback_date(3i)", :string | |
| attribute "callback_date(2i)", :string | |
| attribute "callback_date(1i)", :string | |
| attribute :callback_time, :string | |
| attribute :time_zone, :string | |
| before_validation :make_a_date |
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 Flickr | |
| def self.cached_request | |
| Rails.cache.fetch "photos", :expires_in => 5.minutes do | |
| flickr.photos.getRecent | |
| end | |
| end | |
| 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
| class NameParser | |
| HONORIFICS = ["Mr", "Mrs", "etc"] | |
| def self.parse_full_name(full_name) | |
| full_name.gsub!(/[^a-z- ]/i, '') # check for invalid chars, should we downcase everything? | |
| names = full_name.split(' ') |
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 Movement | |
| attr_reader :distance | |
| def initialize(distance) | |
| @distance = distance | |
| end | |
| def move | |
| puts "moved #{@distance} miles" |
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
| sudo -u postgres psql | |
| psql -d template1 |
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 ArrayFlattener | |
| #recursive function | |
| def flatten_this(arr) | |
| raise ArgumentError, 'Argument is not an array' unless arr.is_a? Array | |
| arr.each_with_object([]) do | element, flat_array | | |
| flat_array.push *( element.is_a?(Array) ? flatten_this(element) : element ) | |
| end | |
| end |
NewerOlder