Skip to content

Instantly share code, notes, and snippets.

View ElMatella's full-sized avatar

Mathieu Marteau ElMatella

View GitHub Profile
{
"aa": {
"name": "Afar",
"nativeName": "Afaraf"
},
"ab": {
"name": "Abkhaz",
"nativeName": "аҧсуа бызшәа"
},
"ae": {
@dillingham
dillingham / Steps.vue
Last active October 27, 2021 15:18
tailwind & vue stepper
<template>
<div class>
<div class="bg-grey-light h-1"></div>
<div class="flex">
<div class="flex-1" v-for="s in steps" :key="s">
<div
v-if="step >= s"
class="bg-blue -mt-1 h-1"
:class="{ 'w-1/2': step == s, 'w-full': step < s }"
></div>
@loilo
loilo / pass-slots.md
Last active October 16, 2024 18:16
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`
    }

const B = {

@mwrouse
mwrouse / Autocomplete.js
Last active September 27, 2024 01:50
Autocompletion for an object in the monaco editor
function ShowAutocompletion(obj) {
// Disable default autocompletion for javascript
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({ noLib: true });
// Helper function to return the monaco completion item type of a thing
function getType(thing, isMember) {
isMember = (isMember == undefined) ? (typeof isMember == "boolean") ? isMember : false : false; // Give isMember a default value of false
switch ((typeof thing).toLowerCase()) {
case "object":
@NNTin
NNTin / savePastDiscordChat.py
Created November 28, 2016 07:37
goes through a text channel's chat log and writes it to a file
import discord
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
@maximilianschmitt
maximilianschmitt / jobs.js
Created September 3, 2014 23:47
Automated MySQL backups to S3 with node.js
'use strict';
var mysqlBackup = require('./mysql-backup');
var schedule = require('node-schedule');
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup);
@ricardozea
ricardozea / Smooth scroll to top of page.markdown
Last active May 12, 2024 12:12
Smooth scroll to top of page

Visit the new improved script here! Smooth scroll to top of page (Improved!)


Smooth scroll to top of page (Legacy!)

If you need a plain JavaScript function to add a smooth scrolling back to the top of the page, you can use this script.

  1. Add an id of "top" to the <body> tag. Like this: <body id="top">
  2. Add the onclick function to the link. Like this: <a href="#top" onclick="scrollToTop(); return false">Back to Top ↑</a>
@ubermuda
ubermuda / nginx.conf
Created November 5, 2013 22:13
Proxy a unix socket HTTP server to a tcp port using nginx.
server {
listen 127.0.0.1:9000;
location / {
proxy_pass http://unix:/var/run/docker.sock:/;
}
}