Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Learning the sh*t out of things

Noud Adrichem noudadrichem

💻
Learning the sh*t out of things
View GitHub Profile
View CityLights.vim
" Vim color file
" Converted from Textmate theme City Lights using Coloration v0.4.0 (http://github.com/sickill/coloration)
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
@noudadrichem
noudadrichem / sliceOutValues.js
Last active Apr 8, 2019
filter double multiple values from array
View sliceOutValues.js
const filteredArray = arr => arr.filter((item, idx, arr) => arr.indexOf(item) === idx)
View fixNav.js
const nav = document.querySelector('#nav');
const topOfNav = nav.offsetTop
function fixNav() {
if(window.scrollY >= topOfNav) {
document.body.classList.add('fixed-nav')
document.body.style.paddingTop = nav.offsetHeight + 'px';
} else {
document.body.classList.remove('fixed-nav')
document.body.style.paddingTop = 0;
@noudadrichem
noudadrichem / ultra-unique-id.js
Created Jan 10, 2019
Returns a id string with a timestamp in it
View ultra-unique-id.js
const timestamp = (new Date().getTime() / 1000 | 0).toString(16);
const uniqueTimeStampId = (stamp) => stamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, () => (Math.random() * 16 | 0).toString(16)).toLowerCase()
View docker-dbs.yml
version: '3'
services:
postgres:
image: postgres
environment:
POSTGRES_PASSWORD: test1234
POSTGRES_USER: noud
restart: always
ports:
- 5432:5432
View split array in 2
function getSplittedArray(arr) {
const first = arr.length % 2 === 0
? arr.splice(0, (arr.length/2))
: arr.splice(0, (arr.length/2 + 1))
const second = arr
return [first, second]
}
View get-domain-from-email.sql
SELECT [email_column], SUBSTRING([email_column], POSITION('@' IN [email_column]) + 1) AS domain_name
FROM [table]
View oracledb
docker run -d -p 49160:22 -p 49162:8080 -p 49161 -v oracledb thebookpeople/oracle-xe-11g
View ipass_dfv_2019_ddl.sql
-- delete
drop table message;
drop table email;
drop table product;
drop table feed;
drop table account;
create table account (
account_id SERIAL PRIMARY KEY not null,
name varchar(255) not null,
@noudadrichem
noudadrichem / getRandomString.js
Created Oct 4, 2019
Return a random string with custom length from assigned characters
View getRandomString.js
function getRandomString(wishedIdLength) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789=-[]\|';
var charactersLength = characters.length;
for (let i = 0; i < wishedIdLength; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}