Skip to content

Instantly share code, notes, and snippets.

View vkaelin's full-sized avatar
🏄
Wanna go surfing

Valentin Kaelin vkaelin

🏄
Wanna go surfing
View GitHub Profile
@reinink
reinink / query.sql
Last active November 14, 2023 11:08
Text search across multiple tables using MySQL
select
first_name,
last_name
from
users
left join
companies on companies.id = users.company_id
where (
companies.name like 'TERM%' or
first_name like 'TERM%' or
@OmegaRogue
OmegaRogue / Directory_Prompts_WT_Uninstall.reg
Last active October 9, 2023 02:46
Registry script to add windows terminal with cmd, powershell and ubuntu profiles to the explorer context menu with normal and admin permissions. To use, replace <Username> with your username
Windows Registry Editor Version 5.00
; Windows terminal
[-HKEY_CLASSES_ROOT\Directory\shell\MenuWindowsTerminal]
[-HKEY_CLASSES_ROOT\Directory\background\shell\MenuWindowsTerminal]
[-HKEY_CLASSES_ROOT\Directory\LibraryFolder\shell\MenuWindowsTerminal]
@ezamelczyk
ezamelczyk / gitcount.sh
Created June 14, 2019 09:45
Git count lines by author
#!/bin/sh
git log --shortstat | grep -E "(Author: )(\b\s*([A-Z]\w+)){2}|fil(e|es) changed" | awk '
{
if($1 ~ /Author/) {
author = $2" "$3
} else {
files[author]+=$1
inserted[author]+=$4
deleted[author]+=$6
}
@Grafikart
Grafikart / DOMAnimation.js
Last active May 25, 2022 09:17
Permet d'animer des éléments HTML
class DOMAnimations {
/**
* Masque un élément avec un effet de repli
* @param {HTMLElement} element
* @param {Number} duration
* @returns {Promise<boolean>}
*/
static slideUp (element, duration = 500) {
return new Promise(function (resolve, reject) {
element.style.height = element.offsetHeight + 'px'
@iamhosseindhv
iamhosseindhv / webpackEncore_browsersync.js
Created July 2, 2018 14:22
Browser sync for Webpack Encore Symfony 4
let config = Encore.getWebpackConfig();
config.watchOptions = { poll: true, ignored: /node_modules/ };
config.plugins.push(
new BrowserSyncPlugin(
{
host: 'aro.tech',
proxy: 'aro.tech',
files: [ // watch on changes
{
match: ['public/build/**/*.js'],
@davisford
davisford / Setup MongoDB on localhost as Replica Set
Last active May 14, 2024 06:37
Setup MongoDB replica set on local host with only a single primary
Add the `replication` section to the mongod.conf file:
```
$cat /usr/local/etc/mongod.conf
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
engine: mmapv1
@stvhwrd
stvhwrd / website-dl.md
Last active March 13, 2024 17:05
Download an entire website for offline use with wget. Internal inks will be corrected so that the entire downloaded site will work as it did online.

The best way to download a website for offline use, using wget

There are two ways - the first way is just one command run plainly in front of you; the second one runs in the background and in a different instance so you can get out of your ssh session and it will continue.

First make a folder to download the websites to and begin your downloading: (note if downloading www.SOME_WEBSITE.com, you will get a folder like this: /websitedl/www.SOME_WEBSITE.com/)


STEP 1:

@addyosmani
addyosmani / README.md
Last active April 2, 2024 20:18 — forked from 140bytes/LICENSE.txt
108 byte CSS Layout Debugger

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

@codeguy
codeguy / slugify.js
Created September 24, 2013 13:19
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}