Skip to content

Instantly share code, notes, and snippets.

Céline Martinet Sanchez celine-m-s

Block or report user

Report or block celine-m-s

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@celine-m-s
celine-m-s / python_vs_ruby.md
Last active May 16, 2018
Python versus Ruby
View python_vs_ruby.md

Ruby

base_class.metadata.sorted_tables
  .each_value
  .select do |value|
    models.any? { |model| value.description.include?(model.__tablename__) }
  end
@celine-m-s
celine-m-s / Dockerfile
Created Apr 2, 2018 — forked from remarkablemark/Dockerfile
Install node and npm with nvm using Docker.
View Dockerfile
# set the base image to Debian
# https://hub.docker.com/_/debian/
FROM debian:latest
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# update the repository sources list
# and install dependencies
RUN apt-get update \
View Ruby on rails cheat sheet
# check ruby version && rbenv
rbenv local
# Check last available version of Ruby
rbenv install --list
# Create app
rails _5.1.4_ new appname --database=postgresql
# Add pg gem to Gemfile
View django_cheat_sheet
# run server
./manage.py runserver
# Interactive shell
./manage.py shell
# don't forget to import the objects you need (models, ...)
# eg from polls.models import Question, Choice
#################################
########### Generators ##########
View git_cheat_sheet
# Update files that are already in the index and commit.
# == git add . + git commit -m "A message"
git commit -a -m "Ajouté itinéraire dans checklist-vacances.md"
# Create a new commit to cancel another one.
git revert SHACommit
# Change last commit message.
git commit --amend -m "Votre nouveau message"
View rspec_cheat_sheet.md

Create a new objet and associate it to a new variable before each scenario or it.

let!(:message) { create(:message) } # if used with FactoryGirl, otherwise Message.create(params)

Check if objets have been created

expect { createsomething }.to change{Message.count}.by(20)

View capybara_cheat_sheet.md

#Matchers

expect(page).to have_content 'Success'
expect(page).to have_xpath("//a",:href => "google.com")
expect(page).to have_selector(:xpath, "//p/h1")
expect(page).to have_selector(:css, "p a#post_edit_path")
expect(page).to have_selector("input", :value =>"Post Title")    

#Actions

View Configure LinkedIn Omniauth
client = get_client
positions = client.profile(:fields => ["positions"])
positions.values # should return a hash with companies, dates and so on.
# This is what I did with Devise:
# devise.rb
config.omniauth :linkedin, ENV['OAUTH_LINKEDIN_ID'], ENV['OAUTH_LINKEDIN_SECRET'],
fields: %w(id email-address first-name last-name headline industry picture-url public-profile-url location num-connections positions)
@celine-m-s
celine-m-s / Javascript Cheat Sheet
Last active Aug 29, 2015
A Javascript cheat sheet for newbies!
View Javascript Cheat Sheet
// Javascript Cheat Sheet
/************************************
*********** DOM: How to... *********
************************************/
// Find an element by its ID
document.getElementById("anId");
// Show an element
element.show();
View video.md
You can’t perform that action at this time.