I have moved the regular expression example repository to the regular GitHub site to encourage contributions.
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
| #!/usr/bin/env ruby | |
| require 'json' | |
| require 'json/add/struct' | |
| require 'awesome_print' | |
| Serial = Struct.new(:foo, :bar, :baz) | |
| s = Serial.new('this','that','the other') | |
| puts 'The Struct instance' | |
| ap s |
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
| #!/usr/bin/env perl | |
| use strict; | |
| use warnings; | |
| my %config = ( | |
| 'limit' => 20000, | |
| 'name' => '/var/log/apache2/blog.access.log' | |
| ); | |
| my $lines = get_lines(\%config); |
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
| #!/usr/bin/env bash | |
| # | |
| # Usage: | |
| # pattern_rename "SED_PATTERN" "FILE_GLOB" | |
| # | |
| # Example: | |
| # pattern_rename.bash 's/^Youtube - //' "*" | |
| # | |
| # Don't forget to put your file glob in quotes. |
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
| function SplitIt(macsplit) { | |
| var temp = new Array(); | |
| var reversed = new Array(); | |
| var re_macsplit = /[A-F0-9]/; | |
| var j = 0; | |
| for (var i = 0; i < macsplit.length; i++) { // Loop through whole MAC ID string | |
| if (re_macsplit.test(macsplit[i])) { // Match to hexidecimal number regexp | |
| temp[j] = macsplit[i]; // Assign number to the array item |
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
| #!/usr/bin/env bash | |
| # Usage in new_script.bash | |
| # source /path/to/backup_mysql.bash | |
| # backup_mysql your_host host_ip user password | |
| function backup_mysql () { | |
| REMOTE_HOST_NAME=$1 | |
| REMOTE_IP=$2 |
Rails Girls South Florida is open to everyone. We are committed to providing a friendly, safe, and welcoming environment for all.
All event participants are expected to act in a way that will foster a safe and positive event experience for everyone during the event and at affiliated social events. Conference participants are expected to:
- Be considerate, respectful, and collaborative.
This evolved rather quickly. It's now at
https://github.com/WorldwideRubyShops/ruby_worldwide
Open a PR to add your company!
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
| #!/usr/bin/env ruby | |
| codes = DATA.readlines | |
| while !codes.empty? | |
| chunk = codes.shift(4) | |
| section = {} | |
| chunk.each do |line| | |
| team, code = line.chomp.split(/\t/) |
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
| #!/usr/bin/env ruby | |
| text = '1,2 3-4,5-6 7,8-9 10-11,12 13 14 1516 17,18' | |
| number_or_range = /\d+(?:-\d+)?/ | |
| puts text.scan(/#{number_or_range},#{number_or_range}/) |