Skip to content

Instantly share code, notes, and snippets.

@manjula-dube
manjula-dube / .eslintrc.js
Created February 6, 2018 15:55
.eslintrc.js
// use this format since .eslintrc is deprecated.
// You can logically derive this format.
module.exports = {
parser: 'babel-eslint',
extends: [
'plugin:flowtype/recommended',
'plugin:jest/recommended',
'plugin:react/recommended',
'eslint-config-airbnb',
## IMPORTANT -> The expectation must come before the invocation, so that it can catch the invocation when it happens
# Able to stub an instance's method. Will return whatever is in the block. The instance's method would have to be invoked in the RSpec.
@person.stub(:get_relevant_experts) { @collection_of_possibilities }
# Expectation of an instance that is available in the testing context to receive a particular method, choose return value
expect(@person).to receive(:get_relevant_experts).with("Medical").and_return(@collection_of_possibilities)
# Expectation of an instance to receive a method and return a result
expect_any_instance_of(Classification).to receive(:valid_matches).and_return(@collection_of_possibilities)
@bootcoder
bootcoder / .bash_profile
Last active December 12, 2020 13:17
bash_profile - rbenv
# echo is like puts for bash (bash is the program running in your terminal)
echo "Loading ~/.bash_profile a shell script that runs in every new terminal you open"
# $VARIABLE will render before the rest of the command is executed
echo "Logged in as $USER at $(hostname)"
# Rbenv autocomplete and shims
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# Path for RBENV
test -d $HOME/.rbenv/ && PATH="$HOME/.rbenv/bin:$PATH"
@adrianhall
adrianhall / .eslintrc.js
Last active April 20, 2024 19:09
A sample .eslintrc file
var OFF = 0, WARN = 1, ERROR = 2;
module.exports = exports = {
"env": {
"es6": true
},
"ecmaFeatures": {
// env=es6 doesn't include modules, which we are using
"modules": true
@jaywon
jaywon / job-import.js
Created November 10, 2015 22:16
CSV import utility for Node
var fs = require('fs');
var csv = require('fast-csv');
var stream = fs.createReadStream('/home/jaywon/Downloads/modified-salary-per-state-per-jobtitle.csv');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var masterList = [];
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost:27017/job-imports');
//define schema for import data
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active March 6, 2023 00:10
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@JuggoPop
JuggoPop / Git branch bash autocomplete *with aliases*
Created April 15, 2014 06:23
Git branch bash autocomplete *with aliases* (add to .bash_profile)
# To Setup:
# 1) Save the .git-completion.bash file found here:
# https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
# 2) Add the following lines to your .bash_profile, be sure to reload (for example: source ~/.bash_profile) for the changes to take effect:
# Git branch bash completion
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
# Add git completion to aliases
@theprogrammerin
theprogrammerin / loadDev.js
Created March 13, 2014 06:46
Load Jquery & Underscore via console
function loadDev(){
var jq = document.createElement("script");
jq.setAttribute("src","http://code.jquery.com/jquery-2.1.0.js")
document.head.appendChild(jq);
var us = document.createElement("script");
us.setAttribute("src","http://underscorejs.org/underscore.js")
document.head.appendChild(us);
console.log("Loaded Jquery and Underscore")
}
loadDev()
@stevenyap
stevenyap / Rails Controller.md
Created October 19, 2013 13:58
Rails controller cheatsheet

Flash

# supports only notice and alert by default
# the rest has to go into flash hash
redirect_to :index, notice: "success"
redirect_to :new, notice: "errors"
redirect_to :new, flash: { success: "yeah" }
flash[:info] = "updated"
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………