Skip to content

Instantly share code, notes, and snippets.

View MACSkeptic's full-sized avatar
🏠
Working from home

♥♥♥♥♥ ����� MACSkeptic

🏠
Working from home
View GitHub Profile
@MACSkeptic
MACSkeptic / README.md
Created July 15, 2021 19:55 — forked from chrisrzhou/README.md
D3 Radar Chart

D3 Radar Chart

bl.ocks.org link

A radar chart visualizes multivariate data in a 2D chart of three or more quantitative variables represented on axes.

The project is created using AngularJS and D3.js.


Description

@MACSkeptic
MACSkeptic / machine.js
Created April 14, 2020 20:21
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
alias.sup=for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
alias.co=checkout
alias.lol=log --oneline --decorate
alias.rhh=!git reset HEAD^ && git reset
alias.st=status -s
alias.rr=!git reset HEAD^ && git reset
alias.dc=diff --cached -w
alias.rc=rebase --continue
alias.aa=add -A .
alias.prom=pull --rebase origin master

UI Tests == DRAFT (2017-05-29) ==

Changelog

Definition (disambiguation)

  • UI Tests use a real browser to perform actions as close as possible to how real users would perform them.
@MACSkeptic
MACSkeptic / code.js
Created February 21, 2017 11:23
pricingplansinversion
const pricingPlansGroupedByServiceLevel =
_.groupBy(_.get(pricingPlans, ['data', 'pricingPlans']) || [], 'id');
// temporary
const flatHack = _.reduce(pricingPlansGroupedByServiceLevel, (finalResult, pricingPlans, serviceLevelId) => {
return _.merge(finalResult, {
[serviceLevelId]: _.flatMapDeep(pricingPlans, pricingPlan => {
return _.flatMapDeep(pricingPlan.commitDiscounts, (commitDiscounts, paymentType) => {
return _.flatMapDeep(commitDiscounts, commitDiscount => {
return _.flatMapDeep(commitDiscount.discounts, discount => {
rec = new webkitSpeechRecognition;
rec.continuous = true;
rec.interimResults = true;
rec.onresult = function (ev) {
console.log(ev.results[ev.results.length-1][0].transcript);
};
rec.start()
(function () {
"use strict";
function x() { console.log(this); }
x();
}())
// -> undefined
(function () {
function x() { console.log(this); }
x();
@MACSkeptic
MACSkeptic / good-morning.js
Created July 29, 2013 10:09
callback is invoked only for indexes of the array which have assigned values (from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
[1, 2].map(function (x) { return x; }) // -> [1, 2]
[1,, 2].map(function (x) { return x; }) // -> [1, undefined × 1, 2]
[1, 2].map(function () { return 'constant'; }) // -> ["constant", "constant"]
[1,, 2].map(function () { return 'constant'; }) // -> ["constant", undefined × 1, "constant"]
@MACSkeptic
MACSkeptic / file.js
Last active December 10, 2015 22:08
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, data = require('./routes/data')
, user = require('./routes/user')
, http = require('http')
, path = require('path');
function authWithCas(req, res) {
var CAS = require('cas');
var cas = new CAS({base_url: 'https://cas.thoughtworks.com/cas', service: 'www.recruiting-dashboard.herokuapp.com'});
var ticket = req.param('ticket');
if (ticket) {
cas.validate(ticket, function(err, status, username) {
if (err) {
// Handle the error