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) {}
/*
* 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();
@yaoduren123
yaoduren123 / LICENSE.txt
Created May 18, 2012 07:15 — forked from jed/LICENSE.txt
convert RGB to HEX
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@yaoduren123
yaoduren123 / LICENSE.txt
Created May 17, 2012 04:47 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@yaoduren123
yaoduren123 / Example1.js
Created March 14, 2012 07:39 — forked from tolmasky/Example1.js
Building a Better JavaScript Profiler with WebKit
document.addEventListener("click", function() { /*...*/ }, false);
@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 = [],
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'