Skip to content

Instantly share code, notes, and snippets.

View VictorTpo's full-sized avatar

Victor Thépaut VictorTpo

View GitHub Profile
@pierrax
pierrax / squash_merge_release.md
Last active June 8, 2016 07:02
How to merge a release branch before deploying

#Go to the release branch

git checkout RELEASE_date

#Pull the last changes

git pull origin RELEASE_date
@yannvery
yannvery / ubuntu_cleanup_packages.md
Last active May 19, 2022 09:44
Ubuntu - Purge old kernels and unused modules

Ubuntu - Purge old kernels and unused modules

Purge old kernels

Open terminal and check your current kernel:

uname -r

DO NOT REMOVE THIS KERNEL!

@yannvery
yannvery / cleanup_ubuntu_mailbox.md
Created January 6, 2016 08:44
Cleanup Ubuntu mailbox

All mails received by a user are stored into: /var/mail/username

Open mailbox without initial display: mail -N
Then delete all mails: d *

@marinados
marinados / intro.py
Last active December 10, 2015 10:18
Pandas, Numpy, SciPy - libraries for vectorized calculations of non structured data
Folium - geographic data
iPython - work environment
List ~ Array (methods: append, insert, del)
Dictionary (dict) ~ Hash
.type ~ .class
| ~ ||
& ~ &&
@LolWalid
LolWalid / collection_methods.rb
Last active December 10, 2015 10:19
Class methods apply to collection - Ruby
class MyModel < ActiveRecord::Base
scope :custom_scope, -> { where.not(id: [1, 2, 3]) } # id not in (1, 2, 3) <=> id != 1 and id != 2 and id != 3
def self.class_method
all.each { |x| puts x }
end
def to_s
'Hey'
end

Sublime hidden Shortcut, macro

All shortcuts

You can find all shortcut in Preferences -> Key bindings - Default

Usefull shortcut

super+k, super+b -> Toggle side bar

super+k, super+v -> Get more paste

@francois-blanchard
francois-blanchard / view_log_with_crontab_tasks.md
Last active December 10, 2015 10:18
View log with crontab tasks

View log with crontab tasks

# 1. Open crontab
$ crontab -e

# 2. Add output log file
30 03 * * * /bin/bash -l -c 'backup perform -t my_backup' >> ~/crontab/backuplog

# 3. Open log file
@francois-blanchard
francois-blanchard / lolcommits.md
Created November 4, 2015 17:23
# Lolcommit : git + webcam

Lolcommit : git + webcam

Gem for take gif when you commit with git

Install

$ brew install imagemagick
$ brew install ffmpeg
$ gem install lolcommits

Use Capybara as genius

Purpose

Capybara uses selector css to find elements, we can do more than ".my-class" or "#my-id". XPath can be used to look for elements using different syntax, see above exemple.

Exemples

gid = class_instance.to_global_id # method allowing to get a string with both model name and id
GlobalID::Locator.locate(gid) # method of getting the object by its global id (very useful for collections of multiple type of objects, e.g. for polymorphic associations)
Example :
In the model that has a polymorphic attribute detailable:
getter:
def global_detailable
detailable.to_global_id if detailable.present?