Skip to content

Instantly share code, notes, and snippets.

View yongzhihuang's full-sized avatar
🎯
Focusing

Yongzhi Huang yongzhihuang

🎯
Focusing
View GitHub Profile
/** @jsx React.DOM */
var React = require('react');
var _ = require('lodash');
var Router = require('react-router');
var Link = Router.Link;
var Grapher = React.createClass({
getDefaultProps: function() {
return {
@yongzhihuang
yongzhihuang / gist:4b2f54f827dda55f6fa6
Created December 29, 2014 15:52
Make slack play sound on new message
javascript:function playSound(b,a){b.mp3?b.mp3.paused?b.mp3.play():b.mp3.pause():(b.mp3=new Audio(a),b.mp3.play())}
setInterval(function(){if(localStorage.lastMessage)b=$(".message").last().find(".message_sender").text().trim(),a=$(".message").last().find(".message_content").text().trim(),a!==localStorage.lastMessage&&(c=/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/,a.match(c)&&a.match(c)[0]&&(a=a.replace(a.match(c)[0],b+" shared a link")),playSound(this,"https://mansueto.campfirenow.com/sounds/incoming.mp3"),localStorage.lastMessage=a);else{var b=$(".message").last().find(".message_sender").text().trim(),
a=$(".message").last().find(".message_content").text().trim(),c=/(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/;a.match(c)&&a.match(c)[0]&&(a=a.replace(a.match(c)[0],b+" shared a link"));playSound(this,"https://mansueto.campfirenow.com/sounds/incoming.mp3");localStorage.lastMessage=a}},2500);

Commit guideline

Try to use useful categorization for each commit, currently there are these categories:

  • [FEATURE] - A new feature or small additions.
  • [STYLE] - Style related commits.
  • [BUGFIX] - A fix for a bug, try to include links to project management ticket # for reference.
  • [DOCS] - Anything relates to documentation, including adding comments, updating readmes.
  • [CONFIG] - Configuration changes.
  • [CLEANUP] - Changes that do not affect functionality such as refactoring, restructuring.
@yongzhihuang
yongzhihuang / gist:663c0d562e3717f4af05
Created July 7, 2015 14:49
Environment based script includes
{{#if GLOBAL.env.development}}
<script src="/path/to/development.js"></script>
{{else}}
<script src="/path/to/prodution.min.js"></script>
{{/if}}
3/02/03
----------
Havn't write this diary for a long time, and time has changed everything. First of all, C++ is no longer my language, I managed to switch to Visual Basic because I finally realized that I want to become a professional database programmer or maybe an administrator. I've place an order of a VB book and it's coming soon. Somehow I got the urge of wanting to buy a laptop computer, I will start saving some money and maybe get a job. OT: I earned $75 yesterday night. Cousin returned from work(again).
10/16/02
----------
It's been a long time, a lot of things have happened. I bought 2 C++ books by accident, (Visual C++ and C++ in 21 days) Right now I'm gonna concentrate on MFC for VC++. I found out that it's very easy to make Windows programs with MFC, if I can handle it well, I might have to study it for a few years, maybe now I will want to become a professional windows developer. I don't know about game programming anymore, it seems too hard, you have to learn about math and other complicated
@yongzhihuang
yongzhihuang / consolelog1.js
Last active November 25, 2015 17:28
Debug mode console log - credit to an kiddy script which I do not have the URL for
var debug = false;
var oldlog = console.log;
console.log1 = function() {
if (debug) {
oldlog.apply(this, Array.prototype.slice.call(arguments));
}
};
//usage
debug = true;
<script type="text/javascript" src="//c.fastcompany.net/multisite_files/fastcompany/static/sites/201602/20/js/omniture-scode-prod.js"></script>
<script type="text/javascript"><!--
fastco_s.server="fastcompany";
fastco_s.channel="homepage";
fastco_s.pageName="fastcompany:homepage:front";
fastco_s.events="event9";
fastco_s.prop4="//www.fastcompany.com";
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html amp="" lang="en-US" class="fonts-loaded" data-reactroot=""><head><meta charset="utf-8"/><meta http-equiv="origin-trial" content="AjQkyiCgG5iPFdJnbc/BHOxiJXzCd8tS1qO2BPNmUcjPhqTAlpCqguyW04T5U5JUik+rrEV/zE5+dMa+k3KT5gYAAABneyJvcmlnaW4iOiJodHRwczovL2Nkbi5hbXBwcm9qZWN0Lm9yZzo0NDMiLCJmZWF0dXJlIjoiV2ViU2hhcmUiLCJleHBpcnkiOjE0ODg4MTA2NjQsImlzU3ViZG9tYWluIjp0cnVlfQ=="/><link rel="canonical" href="https://www.fastcompany.com/40490607/these-5-unconscious-actions-impact-first-impressions-at-interviews"/><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"/><title>These 5 Unconscious Actions Impact First Impressions At Interviews</title><style amp-boilerplate="">body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}
<style>
@font-face {
font-family: "Adobe Caslon";
font-style: normal;
font-weight: normal;
src: url('https://www.newyorker.com/fonts/AdobeCaslonPro-Regular.woff2') format('woff2'), url('https://www.newyorker.com/fonts/AdobeCaslonPro-Regular.woff') format('woff');
}
@font-face {
font-family: "Graphik Web";
font-stretch: normal;
<style>
@font-face {
font-family: "Adobe Caslon";
font-style: normal;
font-weight: normal;
src: url('https://www.newyorker.com/fonts/AdobeCaslonPro-Regular.woff2') format('woff2'), url('https://www.newyorker.com/fonts/AdobeCaslonPro-Regular.woff') format('woff');
}
@font-face {
font-family: "Graphik Web";
font-stretch: normal;