Skip to content

Instantly share code, notes, and snippets.

@MarcBalaban
MarcBalaban / transition.js
Last active January 18, 2021 07:32
transition example
export function Dashboard() {
const [isOpen, setIsOpen] = useState(false);
return (
<div className="h-screen flex overflow-hidden bg-gray-100">
{/* <!-- Off-canvas menu for mobile, show/hide based on off-canvas menu state. --> */}
{isOpen && (
<div className="md:hidden">
<div className="fixed inset-0 flex z-40">
{/*
Off-canvas menu overlay, show/hide based on off-canvas menu state.
{
"cmn":"Mandarin Chinese",
"spa":"Spanish",
"eng":"English",
"rus":"Russian",
"arb":"Standard Arabic",
"ben":"Bengali",
"hin":"Hindi",
"por":"Portuguese",
"ind":"Indonesian",
@MarcBalaban
MarcBalaban / decisionFormula.js
Created January 6, 2019 22:01
Decision Formula
function decisionFormula (activities, n) {
var objMap = {};
activities.forEach(item => {
objMap[item] = 0;
})
for (var i = 0; i < 100; i++) {
objMap[activities[Math.floor(Math.random() * activities.length)]]++;
}
@MarcBalaban
MarcBalaban / frontendChoropleth.js
Created December 5, 2017 21:21
Example of Frontend Choropleth with MapD Charting and us-states.json
<!DOCTYPE html>
<html lang="en">
<head>
<title>MapD</title>
<meta charset="UTF-8">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700,300' rel='stylesheet' type='text/css'>
<style>
.title {
font-weight: bold;
/**
* italic
*
* Tests whether the browser supports faux-italic text in canvas when
* the font itself does not have an italic version (or else the italic
* version has not been loaded into memory).
*
* I do this by using the native font Impact, which does not have a bold
* or italic version, drawing it to a canvas, and checking whether
* anything about the canvas bit-data is different.
@MarcBalaban
MarcBalaban / ReactIgnore
Last active August 29, 2015 14:27 — forked from alexeisavca/ReactIgnore
A simple component to make ReactJs ignore subtrees
var React = require('react/addons');
var ReactIgnore = {
displayName: 'ReactIgnore',
shouldComponentUpdate (){
return false;
},
render (){
return React.Children.only(this.props.children);
}
@MarcBalaban
MarcBalaban / SassMeister-input-HTML.html
Created March 19, 2015 06:04
Generated by SassMeister.com.
<link href='http://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css'>
<div id='stars'></div>
<div id='stars2'></div>
<div id='stars3'></div>
<div id='title'>
<span>
PURE CSS
</span>
<br>
<span>
@MarcBalaban
MarcBalaban / partyTime
Last active August 29, 2015 14:15
Party Time
var partyTime = function(domElement) {
if(domElement.tagName === "DIV"){
domElement.style.background = "#" + Math.random().toString(16).slice(2, 8);
}
var domChildren = domElement.children;
for(var x = 0; x < domChildren.length; x++){
partyTime(domChildren[x]);
}