Skip to content

Instantly share code, notes, and snippets.

View rickbacci's full-sized avatar

Rick Bacci rickbacci

View GitHub Profile
@rickbacci
rickbacci / get_in.rb
Created September 14, 2015 21:13
get in
data = { an_outer: "hash",
with_another: {
inner: "hash",
and_another: {
inside: "that"
}
}
}

Outline:

  • What is Cucumber
    • examples of what it looks like
    • basic folder structure
      • .feature files
      • step definitions
  • What are the benefits of using it?
    • written in plain english
    • helps you keep a broad view of your project
  • defines your feature in simple terms
rails new myapp -T --database=postgresql
# Gemfile
source 'https://rubygems.org'
ruby '2.2.2'
gem 'rails', '4.2.4'
gem 'pg'
  • create app for id and secret
  • omniauth gem
  • setup figaro

initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
end

git revert

git log --oneline -4
git log --patch -3

git revert sha

get sha (at least 7 letters)

@rickbacci
rickbacci / background_workers.markdown
Last active October 29, 2016 14:36
Background Workers
function echo(args) {
if(Array.isArray(args)) {
args.forEach(function(element) {
console.log(element);
});
} else {
for (i = 0; i < arguments.length; i++) {
console.log(arguments[i]);
}
function countdown(seconds, callback){
var interval = setInterval(function () {
if (seconds) {
callback(seconds--);
} else {
clearInterval(interval);
}
}, 1000);
}