Skip to content

Instantly share code, notes, and snippets.

@gabriel-dehan
gabriel-dehan / lesson.rb
Last active October 25, 2017 21:05
New idea/example for teaching inheritance, class methods and self in Ruby
# -------------- INHERITANCE ---------------
class Building # < Object
def initialize(width, length)
@width = width
@length = length
end
# Inheritance example
def has_garden?
@gabriel-dehan
gabriel-dehan / trader.js
Last active October 23, 2017 13:06
cryptohelp
var target = $(".log")[0];
var log = {};
// level 3 error
// level 2 warn
// level 1 info
// level 0 debug
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes.length > 0) {
var node = $(mutation.addedNodes[0]),
@gabriel-dehan
gabriel-dehan / actualdoc.coffee
Created October 11, 2017 14:20
cryptotrader
# Some helpful API and implementation notes
# by: SimonSays
init: (context) -> #This si where we 'initialize' - this class is executed when the bot is first started or is restarted.
# This is where you set your variable initial values.
# The variable must start with context. (or if you choose another object definition. i.e. init: (c) -> works as well and requires c. prefix
#
# #We have three options for sending notifications to the trader log. Debug is black, info is Green and warn is Red
debug "Hello - welcome!"
@gabriel-dehan
gabriel-dehan / install.md
Last active September 4, 2017 21:11
Teleclimac

Install brew if you don't have it.

$ cd ~ && mkdir .telegram-cli && cd .telegram-cli && git clone --recursive https://github.com/vysheng/tg.git && cd tg

Then.

$ export CPPFLAGS="-I/usr/local/opt/openssl/include"
$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="style.css"/>
<title>Portfolio</title>
</head>
<body>
<div class="contain">
<div class="welcome-wrapper">
@gabriel-dehan
gabriel-dehan / filterAmz.js
Last active January 19, 2017 22:27
filterAmazon script. Copy paste then call filterAmazon(YOUR_NUMBER);
var filterAmazon = (function(filterNum) {
window.AMZ_FILTER = (function(number) {
jQuery('.a-color-price, .sx-price').map(function(i, e) {
let num = parseFloat(jQuery(e).text().replace(/£|\$|€/, ''));
if (num < number) {
return jQuery(e).parents(".zg_itemImmersion, .zg_more_item, .s-item-container").hide();
} else {
return null;
}
});
@gabriel-dehan
gabriel-dehan / admin.rb
Last active December 14, 2016 11:44
OOP in ruby Dawan
require_relative 'user.rb'
class Admin < User
attr_accessor :role
def initialize(attributes, description)
super(attributes)
@description = description
@admin = true
end
@gabriel-dehan
gabriel-dehan / array_to_hash.rb
Last active December 13, 2016 14:46
exerices - jour 2
=begin
def array_to_hash(array)
hash = {}
i = 0
array.each do |element|
hash[index] = element
i += 1
end
hash
@gabriel-dehan
gabriel-dehan / exercice1.rb
Last active December 12, 2016 16:38
Correction Exercices Ruby du Jour 1 - Dawan
# Permutation
question = "La vie ?"
answer = 42
puts question
puts answer
# Methode 1
temp = question
question = answer
@gabriel-dehan
gabriel-dehan / exemples.rb
Created December 12, 2016 15:17
Cours Jour 1
# Commentaire sur une ligne
=begin
Commentaire multi ligne
int number1 = 5
int add(int* n1, int n2) {
n1 = 6;
return n1 + n2;
}