There are three flags available for js: global, ignorecase, and multiline.
/**
* Regular expression flag bits. They can be or'ed to enable a set
* of flags.
Rails actually throws an error for cookies greater than 4k https://github.com/rails/rails/blob/6dd0dc3e7217f8af7877c5831b3d8816d156f21e/actionpack/lib/action_dispatch/middleware/cookies.rb#L99
def port_open?(ip, port, timeout = 3) | |
Timeout::timeout(timeout) do | |
begin | |
TCPSocket.new(ip, port).close | |
{open: true} | |
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH | |
{open: false} | |
end | |
end | |
rescue Timeout::Error |
#!/usr/bin/env ruby | |
require 'rubocop' | |
ADDED_OR_MODIFIED = /A|AM|^M/.freeze | |
changed_files = `git status --porcelain` | |
.split(/\n/) | |
.select { |file| file =~ ADDED_OR_MODIFIED } | |
.map { |file| file.split(' ')[1] } |
# | |
# Shorthands | |
# | |
%w() # word array delimited by spaces | |
%r() # is another way to write a regular expression. | |
%q() # is another way to write a single-quoted string (and can be multi-line, which is useful) | |
%Q() # gives a double-quoted string | |
%x() # shell command | |
%i() # an array of symbols |
find_users: cat /etc/passwd | grep "/home" | cut -d: -f1 |
Generates a new stylesheet for each active view helper function called in the view. | |
- Names it according to the route because we know it is going to be unique. | |
- Also tried to optimize head links as much as possible for rails apps. | |
HOWTO | |
- know which styles are in the head of the document. Maybe using something like capybara? |
/config | |
-> Specify path to folder (intended as a construct your own framework approach) | |
-> Should be extendable so if we want to add a new concept we can specify it then access it through the app object | |
/router | |
-> the router just passes it to the object (controller?) where the method name is the http method type | |
e.g get("/connor", "connor") would look for just a get method in "ControllerDir"/connor.js.get(req, res); | |
get("/connor") default to a formatting of the route name (/connor/horse-foot) = connorHorseFoot.js unless name passed in | |
route("/connor") doesn't care about the method, will pass in and try use method name from the object (throws 404|500 if not found) | |
resource("/connor") for REST | |
sockets("/connor") for sockets -> decide on some kind of protocal for message passing. The arguments passed to the controller callback will be different. |
- name: | |
twitter: | |
bio: **optional** Max 200 chars |
- name: Connor Atherton | |
twitter: ConnorAtherton6 | |
bio: **optional** max 200 chars | |
- name: | |
twitter: | |
bio: |