Skip to content

Instantly share code, notes, and snippets.

@yaoduren123
yaoduren123 / index.html
Created November 21, 2020 01:32
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
@yaoduren123
yaoduren123 / RGB-Hex.js
Created January 19, 2017 04:56 — forked from Arahnoid/RGB-Hex.js
Bunch of RGB to Hex and Hex to RGB convert javascript functions what works well in Photoshop
///////////////////////////////////////////////////////////////////////////////////
/// Colection of RGB to HSB, HSB to RGB convert functions
/// Source: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
///////////////////////////////////////////////////////////////////////////////////
/**
* componentToHex convert two digit htx value to R, G or B chanel value
* @param number c value from 0 to 225
* @return string value of R, G or B chanel
* @usage //alert (componentToHex(255)); //ff
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@yaoduren123
yaoduren123 / bezier.js
Last active August 29, 2015 14:22 — forked from LiuJi-Jim/bezier.js
function DeCasteljauBezier(points, density, step){
//if (points.length < 3) return null;
console.time('bezier');
var ps = points.map(function(p){
return {
x: p.x,
y: p.y
};
}),
results = [],
@yaoduren123
yaoduren123 / animate.js
Last active August 29, 2015 14:06 — forked from oodavid/animate.js
// sdk/timestep/ui/backend/animate.js
/**
* @license
* This file is part of the Game Closure SDK.
*
* The Game Closure SDK is free software: you can redistribute it and/or modify
* it under the terms of the Mozilla Public License v. 2.0 as published by Mozilla.
* The Game Closure SDK is distributed in the hope that it will be useful,
@yaoduren123
yaoduren123 / easing.js
Last active August 29, 2015 14:06 — forked from frederickk/easing.js
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
var EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
/**
* Create cross browser transition CSS
*
* @param {Integer} duration Duration in milliseconds.
* @param {String} easing Easing function. Can be built-in CSS3 function or one of the provided custom functions.
* @param {String} prop CSS property to apply transition to.
*/
function transitionCss(duration, easing, prop) {
var easingDefs = {
easeInCubic : 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
var beziers = {
easeInQuad: '.55,.085,.68,.53'
, easeInCubic: '.55,.055,.675,.19'
, easeInQuart: '.895,.03,.685,.22'
, easeInQuint: '.755,.05,.855,.06'
, easeInSine: '.47,0,.745,.715'
, easeInExpo: '.95,.05,.795,.035'
, easeInCirc: '.6,.04,.98, .335'
, easeInBack: '.6,-.28,.735,.045'
, easeOutQuad: '.25,.46,.45,.94'
/*
* Simple Pub/Sub Implementation for jQuery
*
* Inspired by work from Peter Higgins (https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js)
*
* This is about the simplest way to write a pubsub JavaScript implementation for use with jQuery.
*/
(function( $ ) {
// Cache of all topics
@yaoduren123
yaoduren123 / gist:3608247
Created September 3, 2012 10:04 — forked from remy/gist:350433
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();