Skip to content

Instantly share code, notes, and snippets.

View brossetti1's full-sized avatar

Brian Rossetti brossetti1

View GitHub Profile
@brossetti1
brossetti1 / useful-regex.md
Last active August 1, 2024 17:58
useful regex expressions

https://www.labnol.org/internet/regular-expressions-forms/28380/

Postal Address

[a-zA-Z\d\s\-\,\#\.\+]+

allow only alphanumeric characters, spaces and few other characters like comma, period and hash symbol in the form input field.

ZIP Code

^\d{5,6}(?:[-\s]\d{4})?$

the regex allows ZIP codes in standard formats and it matches both US and Indian pincodes.

@brossetti1
brossetti1 / README.md
Created August 7, 2018 10:36 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@brossetti1
brossetti1 / history
Created July 5, 2018 21:08
history functions that are good to have
zsh histroy
pry history
(function() {
var k, aa = "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) {
if (c.get || c.set) throw new TypeError("ES3 does not support getters and setters.");
a != Array.prototype && a != Object.prototype && (a[b] = c.value)
},
ba = "undefined" != typeof window && window === this ? this : "undefined" != typeof global && null != global ? global : this,
ca = function(a, b) {
if (b) {
for (var c = ba, d = a.split("."), e = 0; e < d.length - 1; e++) {
var f = d[e];
group :spec do
guard('rspec', all_on_start: false,
all_after_pass: false,
run_all: { parallel: true, parallel_cli: '-n 4' },
cmd: 'zeus rspec',
notification: true,
failed_mode: :keep) do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
# Generic Utilities
using_port() {
ps -p $(lsof -i:$1 -Fp | cut -c 2-)
}
most_used() {
history | awk '{a[$4]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head -20
}
export PROCESSES_TO_QUIT='bpos puma rake sidekiq spring rails$ ruby-debug phantomjs zeus passenger guard resque "node server.js" ruby$ node foreman fsevent_wat'
pgr() {
echo "Finding processes in list: $PROCESSES_TO_QUIT"
echo $PROCESSES_TO_QUIT | xargs -n 1 pgrep -l
}
pgk() {
echo "Killing processes in list: $PROCESSES_TO_QUIT"
echo $PROCESSES_TO_QUIT | xargs -n 1 pkill -l
ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../../config/environment", __FILE__)
require "rspec/rails"
require "rspec/mocks"
require "capybara/rspec"
require "vcr"
require "rails/application"
require "webmock/rspec"
require "shoulda/matchers"
require "capybara-screenshot/rspec"

from https://github.com/shakacode/style-guide-ruby#fileclass-level-comments

# Automatic conversion of one locale to another where it is possible, like
# American to British English.
module Translation
  # Class for converting between text between similar locales.
  # Right now only conversion between American English -> British, Canadian,
  # Australian, New Zealand variations is provided.
  class PrimAndProper
omniauth-facbook: https://github.com/brossetti1/shrine-s3-lamda-processing-example/commit/31baa924220e29270e59c568ed51643f25bcabd7
shrine-setup: https://github.com/brossetti1/shrine-s3-lamda-processing-example/commit/76429d764e93332100378c2de37bac5a5710de6a
shrine-s3-seperate: https://github.com/brossetti1/shrine-s3-lamda-processing-example/commit/e56e03f50b2060373e0b14b39ec4aa5d775803ab
shrine-s3-full: https://github.com/brossetti1/shrine-s3-lamda-processing-example/pull/2/files