Skip to content

Instantly share code, notes, and snippets.

View lossendae's full-sized avatar

Stéphane Boulard lossendae

View GitHub Profile
@lossendae
lossendae / recursive.sql
Last active August 29, 2015 14:19
Discovering POSGRESQL - CTE
WITH RECURSIVE
subdept AS (
SELECT
d.department_id,
d.department_parent_id,
d.name department_name
FROM department d
JOIN employee e USING (department_id)
WHERE e.employee_id = 13
UNION ALL
@lossendae
lossendae / postgresql-cte.sql
Created April 17, 2015 16:05
POSTGRESQL CTE - With prepared statement, parameter and projection mapping
PREPARE emp_info AS
WITH RECURSIVE
subdept(id, name, parent_id) AS (
SELECT
emp.department_id,
dpt.name,
dpt.department_parent_id
FROM department dpt
@lossendae
lossendae / config.git
Created June 24, 2016 13:19
Git config global
core.autocrlf=input
...
alias.ll=log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
alias.co=checkout
alias.ci=commit
alias.br=branch
alias.st=status
alias.cop=!git checkout $1 && git pull origin $1
alias.cob=checkout -b $1
alias.fp=!git push origin develop master && git push --tags
@lossendae
lossendae / git-tag-delete-local-and-remote.sh
Created July 5, 2017 13:33 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@lossendae
lossendae / userChrome.css
Created December 9, 2017 10:51
Firefox Quantum personal toolbar
/* in windows (may need to create the chrome folder) : %APP_DATA% Roaming\Mozilla\Firefox\Profiles\xxxxxxx.default\chrome */
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/* Center the personal toolbar items */
#PlacesToolbarItems {
-moz-box-pack: center
}
/* Padding Adjustements */
@lossendae
lossendae / task.rb
Created February 15, 2018 20:58 — forked from povodok/task.rb
require 'uri'
require 'net/http'
require 'json'
class UpdatesIssuesNotifierListener < Redmine::Hook::Listener
CALLBACK_URL = 'https://localhost:3333'.freeze
def controller_issues_edit_after_save(context)
data = {
'issueid' => context[:issue].id,
@lossendae
lossendae / SessionBuilder.php
Last active March 2, 2018 12:41
Pomm auto tagging model & model layer, use custom session builder for query logs
<?php
namespace App\Model;
use PommProject\Foundation\Converter\ConverterHolder;
use PommProject\Foundation\Session\Session;
use PommProject\ModelManager\SessionBuilder as ModelManagerSessionBuilder;
/**
* Class SessionBuilder
*
@lossendae
lossendae / stringUtils.js
Created May 30, 2018 21:15 — forked from cvergne/stringUtils.js
Little javascript method to get initials from a name
String.prototype.getInitials = function(glue){
if (typeof glue == "undefined") {
var glue = true;
}
var initials = this.replace(/[^a-zA-Z- ]/g, "").match(/\b\w/g);
if (glue) {
return initials.join('');
}
@lossendae
lossendae / .powerlinerc
Last active June 28, 2018 06:21
ZSH config
# General config
POWERLEVEL9K_MODE='nerdfont-fontconfig'
POWERLEVEL9K_INSTALLATION_PATH=$ANTIGEN_BUNDLES/bhilburn/powerlevel9k
# prompt
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status dir_writable time)
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator user dir vcs)
# other options
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
@lossendae
lossendae / merge_json.sql
Last active March 29, 2021 12:54
Various POSTGRESQL helpers
with
test as (
select *
from (
values
(123, '{"key_1": {"value_1": 1}}'::jsonb),
(123, '{"key_2": {"value_2": 2}}'::jsonb),
(123, '{"key_3": {"value_3": 3}}'::jsonb),
(456, '{"key_4": {"value_4": 4}}'::jsonb),
(456, '{"key_1": {"value_3": 4}}'::jsonb)