Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Jérôme Lanteri jerome-diver

🏠
Working from home
View GitHub Profile
View out1.txt
:: Synchronizing package databases...
core is up to date
extra is up to date
community is up to date
multilib is up to date
resolving dependencies...
looking for conflicting packages...
Package (1) Old Version New Version Net Change
View gist:84a340823b230fbc9022a7f256aa3b1b
const useFetch = (crud_call, data, trigger) => {
const [ loading, setLoading ] = useState(true)
const [ error, setError ] = useState({state: false, content: ""})
const [ containers, setContainers ] = useState({})
useEffect(() => {
// should call the string crud_call as a function:
/*
if (crud_call in ['getContainer', 'getChildrenContainersOf', 'getContainersOfType',
'updateContainer', 'createContainer', 'deleteContainer']) {
console.log("FETCHING NOW with %s for language %s", crud_call, trigger)
View main.lua
#! /usr/bin/lua5.3
--[[
Test lgi Lua package with GooCanvas and Modelized items
--]]
local lgi = require 'lgi'
local Goo = lgi.GooCanvas
local Gtk = lgi.Gtk
local win = Gtk.Window { width = 640, height = 500, anchor = Gtk.GTK_WINDOW_TOPLEVEL }
View main.lua
#! /usr/bin/lua5.3
--[[
Test lgi Lua package with GooCanvas and Modelized items
--]]
local lgi = require 'lgi'
local Goo = lgi.GooCanvas
local Gtk = lgi.Gtk
local win = Gtk.Window { width = 640, height = 500, anchor = Gtk.GTK_WINDOW_TOPLEVEL }
View main.lua
--[[
Test lgi Lua package with GooCanvas and Modelized items
----]]
local lgi = require 'lgi'
local Goo = lgi.GooCanvas
local Gtk = lgi.Gtk
local win = Gtk.Window { width = 640, height = 500, anchor = Gtk.GTK_WINDOW_TOPLEVEL }
local frame = Gtk.Frame { width = 400, height = 400 }
@jerome-diver
jerome-diver / tic_tac_toe.js
Created Aug 28, 2020
i think i get it now... sorry for your time
View tic_tac_toe.js
const readline = require('readline');
/**
Instructions
- Upon completion the program should let two players play Tic Tac Toe
- You can implement your own functions when you need to, or modify existing ones
- The isGameWon() functions has some bugs, you need to find the bugs and fix them
- Implement the playing logic in the playGame function
- Thinking of edge cases and handling them is a plus
- executing 'await readInput();' in the playGame() function will read input from the console
@jerome-diver
jerome-diver / use_case_get_static_var.py
Created May 12, 2020
How super mixins can find metaclass child variable
View use_case_get_static_var.py
class MixinsBuilder:
"""From child static variable, i'm going to build attributes"""
def build_attributes(self):
my_meta_var = self.???[0]
for k, v in my_meta_var:
if not hasattr(self, k):
setattr(k, v)
View keybase.md

Keybase proof

I hereby claim:

  • I am jerome-diver on github.
  • I am jeromelanteri (https://keybase.io/jeromelanteri) on keybase.
  • I have a public key ASDPxWjOCUODu-xi6_JBP-JaCpGhzRTPbdpmlKBnrEgergo

To claim this, I am signing this object:

@jerome-diver
jerome-diver / subprocess_out_to_json
Last active Apr 21, 2020
trying to get json object from command returning json through subprocess call
View subprocess_out_to_json
import json
import subprocess
# you need to have taskwarrior application installed on the Linux system to rich the shell command to return a json data
j = json.loads(subprocess.run(["task", "status:pending", "export"], capture_output=True, check=True).stdout)
@jerome-diver
jerome-diver / custom_failure.rb
Created Mar 18, 2020
trying to redirect_to controller users/session action new as JS, but get back 422 error due to forgery protection
View custom_failure.rb
class CustomFailureApp < Devise::FailureApp
def redirect
store_location!
message = warden.message || warden_options[:message]
puts("Messages from Warden: #{message}")
case message
when :timeout
redirect_to root_path
when :unconfirmed
redirect_to new_user_session_path(format: :js)