Skip to content

Instantly share code, notes, and snippets.

View favoyang's full-sized avatar

Favo Yang favoyang

View GitHub Profile
@loilo
loilo / pass-slots.md
Last active July 4, 2025 09:46
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 = {

@benoitvogel
benoitvogel / wagtail_hooks.py
Created April 8, 2018 23:26
Add a button linked to a span with a class in Wagtail/Draftail
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
from wagtail.admin.rich_text.converters.html_to_contentstate import InlineStyleElementHandler
from wagtail.core import hooks
@hooks.register('register_rich_text_features')
def register_custom_style_feature(features):
feature_name = 'mycustomstyle' # .mycustomstyle will have to be defined in the CSS in order to get frontend styles working
type_ = feature_name.upper()
tag = 'span'
@howar31
howar31 / simple_scrollbar_hover_effect.css
Last active September 26, 2024 08:32
Neat and clean scrollbar with hover transition effect CSS
// Scrollbar with Hover Transition Effect
.container::-webkit-scrollbar {
width: 14px;
}
.container::-webkit-scrollbar-thumb {
background-clip: content-box;
border: 4px solid transparent;
border-radius: 7px;
box-shadow: inset 0 0 0 10px;
}
@LotteMakesStuff
LotteMakesStuff / 1.md
Last active June 30, 2025 09:30
UPM: How to make a custom package

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!

@dpboard
dpboard / 1-PIPENVANDSETUP.md
Last active June 5, 2024 09:14
How pipenv and setup.py work together

How Pipenv and setup.py work together

I've always found the world of python packaging and environment management to be somewhat confusing. Here are some notes that I hope will remind me how it works when I forget.

N.B. I have focused on Pipenv and Pipfile in this article, as they are the latest and greatest way of managing project environments, but the same principles apply to older workflows using virtualenv, pip and requirements.txt.

What is setup.py for?

@hasanbayatme
hasanbayatme / README.md
Last active January 15, 2024 06:59
A Scene Switcher Utility Window for Unity

Scene Switcher

A Scene Switcher Utility Window for Unity, Switch between Scenes Effortlessly.

Inspired by Kenney sceneWindow.cs

Deprecation Notice

This gist is deprecated due to release of this utility on Asset Store, you can now get the latest version of this utility from Asset Store, but it is available here as is without any updates.

@nikkanetiya
nikkanetiya / axios-nprogress.js
Created September 6, 2017 12:40
NProgress bar with axios
import 'nprogress/nprogress.css'
import NProgress from 'nprogress'
import axios from 'axios'
const calculatePercentage = (loaded, total) => (Math.floor(loaded * 1.0) / total)
const setupUpdateProgress = () => {
axios.defaults.onDownloadProgress = e => {
const percentage = calculatePercentage(e.loaded, e.total)
@sebble
sebble / stars.sh
Last active July 14, 2025 18:55
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo
@bmihelac
bmihelac / wagtail_struct_block_validation.py
Created January 5, 2017 15:28
Example validating wagtail StructBlock
from django.core.exceptions import ValidationError
from django.forms.utils import ErrorList
from wagtail.wagtailcore import blocks
class MyLinkBlock(blocks.StructBlock):
"""
Example validating StructBlock.
"""
@texus
texus / Transparent.cpp
Last active November 23, 2024 15:49
Translucent per-pixel alpha window on Windows
#include <SFML/Graphics.hpp>
#if _WIN32_WINNT < 0x0501
#define _WIN32_WINNT 0x0501
#endif
#include <windows.h>
// Set part of the window that can be clicked by removing fully transparent pixels from the region
void setShape(HWND hWnd, const sf::Image& image)
{