Skip to content

Instantly share code, notes, and snippets.

View bsurnida's full-sized avatar

Bhasker Surnida bsurnida

  • Oracle Corporation
  • Redwood Shored, San Francisco, CA.
View GitHub Profile
@bsurnida
bsurnida / README.md
Created February 20, 2020 03:11 — forked from mstanaland/README.md
Stacked bar chart with tooltips

A simple stacked coloumn graph built using d3's stack layout.

The SVG tooltip is based on this gist by Mike Bostock. In short, the tooltip's group, comprised of a rect and a text element, are created when the chart is first drawn and set to be hidden. Action is applied to the stacks' rects: on mouseover the group become visible; on mousemove the mouse's XY position is captured and used to transform/translate the group.

If you ajust the tooltip's XY offset, keep in mind that there can be no overlap between the group and the mouse's position or the group's visibility will remain hidden.

@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active March 13, 2025 03:37
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@alxmtr
alxmtr / gulpfile.js
Last active June 23, 2022 03:22
Sass & Pug + BrowserSync
const { src, dest, watch, series } = require('gulp')
const pug = require('gulp-pug')
const sass = require('gulp-sass')
const browserSync = require('browser-sync').create()
// Compile pug files into HTML
function html() {
@rverton
rverton / chrome_headless_screenshot.py
Created July 10, 2017 08:53
Make a screenshot with a headless google chrome in python
# Install chromedriver from https://sites.google.com/a/chromium.org/chromedriver/downloads
import os
from optparse import OptionParser
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CHROME_PATH = '/usr/bin/google-chrome'
@SergeyAvd
SergeyAvd / useRunningBrowser.js
Created February 6, 2017 21:48
Basic example modified to use an already running Chrome browser
// google_search.js
var chromeDriver = require('chromedriver'), // Auto install ChromeDriver
webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var chrome = require("selenium-webdriver/chrome");
var options = new chrome.Options();
options.options_["debuggerAddress"] = "127.0.0.1:6813";
var driver = new webdriver.Builder()
@dfontana
dfontana / CmderZSH.md
Last active March 23, 2025 13:30
My setup guide for installing Cgywin, Mintty, Cmder, and ZSH.

What's this?

Instructions to obtain ZSH on a windows environment, without the input funny business presented by some other attempted solutions.

The final result is ZSH running on a mintty terminal, emulated by cygwin, and being handled by the popular cmder.

Why is this here?

For the benefit of myself and others. I've already followed these instructions twice. It took me hours to figure all this out, maybe someone else can save a few.

What exactly is covered?

  • Installing and setting up cmder
@gerarldlee
gerarldlee / Experimenting with ChromeOS on VirtualBox.md
Last active March 21, 2025 03:01
Installing ChromeOS on VirtualBox using the NeverWare build

Installing ChromeOS on VirtualBox

  1. Download the NeverWare's ChromeOS build from http://www.neverware.com/freedownload

  2. Extract the *.bin.zip

  3. Convert it to VDI. vboxmanage convertdd chromiumos_image.bin chromiumos_image.vdi

  4. mv chromiumis_image.vdi C:\t\v\chromeos\

@DeoluA
DeoluA / wordFreqWithLodash.html
Last active September 9, 2018 06:48
Get the frequency of words in a string using Lodash. AngularJS is used here for interactive functionality.
<!DOCTYPE html>
<head>
<script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js'></script>
<script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js'></script>
<script type="text/javascript" src='wordFreq.js'></script>
</head>
<body ng-app='wordFreqApp'>
<div ng-controller='wordFreqCtrl'>
<h2>Input something below</h2>
@1Cr18Ni9
1Cr18Ni9 / .block
Last active February 20, 2020 03:07
BarChart with ToolTip
license: mit
@robinrendle
robinrendle / browsersync-webpack.md
Last active September 17, 2024 16:58
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.