Skip to content

Instantly share code, notes, and snippets.

View SuneBear's full-sized avatar

Shule Hsiung SuneBear

View GitHub Profile
@jurStv
jurStv / adressForm.js
Created September 13, 2015 23:16
The event handler detached in adressForm.js Do not pay attention to Validator instances, it's just for filtering table-items and checking valid.
import {Rx} from "@cycle/core";
import {h} from '@cycle/dom';
import Validator from "../form-validator";
import cuid from "cuid";
let formValidator = new Validator({
name: /^\S+/,
lastname:/^\S+/,
email:/^\S+@\S+\.\S+/
});
@milankarunarathne
milankarunarathne / ES6_Singlet.js
Last active February 10, 2017 13:10
Create Singleton pattern using ES6
'use strict';
/**
* Created by Milan Karunarathne
* Email: mhkarunarathne@gmail.com
* May be freely distributed under the MIT license
*/
import EventEmitter from 'events';
class Single extends EventEmitter {
@roddds
roddds / gist:a1f42bae598028ac7809
Last active September 1, 2026 18:06 — forked from raddevon/gist:67935d320ee9b726d19d
Adobe tries to strong-arm me into keeping Creative Cloud

To everyone who got here through Twitter or Facebook or Hacker News or whatever: THIS IS NOT ME.

The "Me" in this transcript is @raddevon, who shared his story first on reddit.


List of incompetent jackasses who can't check a source if their lives depended on it:

@btroncone
btroncone / ngrxintro.md
Last active August 5, 2026 05:48
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@thorsten
thorsten / setUserAgent.js
Created May 9, 2016 15:12
Override user agent on all browsers
function setUserAgent(window, userAgent) {
// Works on Firefox, Chrome, Opera and IE9+
if (navigator.__defineGetter__) {
navigator.__defineGetter__('userAgent', function () {
return userAgent;
});
} else if (Object.defineProperty) {
Object.defineProperty(navigator, 'userAgent', {
get: function () {
return userAgent;
@mattdesl
mattdesl / billboard.glsl
Created January 18, 2017 22:52
billboarding in GLSL
attribute vec3 position;
uniform mat4 modelViewMatrix;
uniform mat4 modelMatrix;
uniform mat4 projectionMatrix;
uniform float scale;
uniform float size;
uniform float aspect;
varying vec2 vUv;
@ayamflow
ayamflow / gist:96a1f554c3f88eef2f9d0024fc42940f
Last active August 3, 2025 07:01
Threejs Fit plane to screen
var cameraZ = camera.position.z;
var planeZ = 5;
var distance = cameraZ - planeZ;
var aspect = viewWidth / viewHeight;
var vFov = camera.fov * Math.PI / 180;
var planeHeightAtDistance = 2 * Math.tan(vFov / 2) * distance;
var planeWidthAtDistance = planeHeightAtDistance * aspect;
// or
@LiekeVanmulken
LiekeVanmulken / Perlin_js_impl.js
Created October 5, 2017 12:35
Perlin implementation in javascript, ported from https://gist.github.com/Flafla2/f0260a861be0ebdeef76
// Implementation of perlin noise, ported from https://gist.github.com/Flafla2/f0260a861be0ebdeef76 to js.
var repeat = -1;
var setRepeat = function(repeat) {
this.repeat = repeat;
};
/**
@adambradford
adambradford / style.css
Last active February 8, 2022 09:08
Halftone overlay effect for background images in CSS
.container {
background: url('path/to/background.jpg');
background-size: cover;
background-repeat: no-repeat;
position: relative; /* use this if optional inner container is used */
}
.container:after {
background-image: linear-gradient(45deg, #666 25%, transparent 25%),
linear-gradient(-45deg, #666 25%, transparent 25%),
@bgolus
bgolus / StereographicProjectionBubble.shader
Created February 28, 2020 06:33
Modifying UVs using stereographic projection to create the illusion of a sphere.
Shader "Unlit/StereographicProjectionBubble"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_PanSpeed ("Pan Speed", Float) = 0.1
_Spherify ("Spherify", Range(0,1)) = 1
}
SubShader
{