Skip to content

Instantly share code, notes, and snippets.

Christiaan Maks Christilut

Block or report user

Report or block Christilut

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Christilut
Christilut / countries.js
Created Aug 22, 2019
shazam country codes
View countries.js
[
{
id: "US",
name: "United States",
listid: "country-chart-US",
cities: [
{
id: "80149",
name: "Aberdeen SD",
countryid: "US",
@Christilut
Christilut / README.md
Created May 7, 2019
mongodb local replicaset
View README.md
@Christilut
Christilut / download.ts
Created Apr 10, 2019
download file from string
View download.ts
export function download (data: any, filename: string) {
const url = window.URL.createObjectURL(new Blob([data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', filename)
document.body.appendChild(link)
link.click()
}
@Christilut
Christilut / hasParentWithMatchingSelector.js
Created Jan 8, 2019
Javascript function to check if target is inside parent selector
View hasParentWithMatchingSelector.js
function hasParentWithMatchingSelector(target, selector) {
return [...document.querySelectorAll(selector)].some(el =>
el !== target && el.contains(target)
)
}
@Christilut
Christilut / tooltip.js
Last active Jan 8, 2019
Vue component for showing a simple tooltip
View tooltip.js
Vue.component('tooltip', {
name: 'tooltip',
props: {
disabled: Boolean,
x: {
type: Number,
default: 0
},
y: {
@Christilut
Christilut / transition.scss
Last active Jan 8, 2019
Vue component for dynamic height show/hide transitioning
View transition.scss
.expand-enter-active,
.expand-leave-active {
transition: height 0.4s ease;
overflow: hidden;
}
.expand-enter,
.expand-leave-to {
height: 0;
}
View generate layout helpers.scss
$g: 20px;
$props: (
(margin, ma),
(margin-top, mt),
(margin-bottom, mb),
(margin-left, ml),
(margin-right, mr),
(padding, pa),
(padding-top, pt),
View timeout.ts
async function timeout(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms))
}
View VCurrencyField.vue
<template lang="pug">
v-text-field(
ref='field',
:prefix='prefix',
v-model='model',
@focus='onFocus',
@keyup='onKeyUp',
:error-messages='errorMessages',
v-bind='$attrs',
@change='onChange'
View ISO-639-1 Code
JSON.stringify($.map($('.devsite-table-wrapper').first().find('tbody tr'), (x) => {
return {
label: $(x).find('td').first().text(),
code: $(x).find('td:eq(1)').text()
}
}), null, ' ')
// dont forget to remove some comments
You can’t perform that action at this time.