Skip to content

Instantly share code, notes, and snippets.

@skokenes
skokenes / d3-lasso.min.js
Last active November 5, 2020 07:44
d3.lasso example - scatterplot
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-selection"),require("d3-drag")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-drag"],n):n(t.d3=t.d3||{},t.d3,t.d3)}(this,function(t,n,r){"use strict";function e(t,n){return n={exports:{}},t(n,n.exports),n.exports}function o(){function t(t){function u(){p=[],h="",_.attr("d",null),m.attr("d",null),r.nodes().forEach(function(t){t.__lasso.possible=!1,t.__lasso.selected=!1,t.__lasso.hoverSelect=!1,t.__lasso.loopSelect=!1;var n=t.getBoundingClientRect();t.__lasso.lassoPoint=[Math.round(n.left+n.width/2),Math.round(n.top+n.height/2)]}),s&&r.on("mouseover.lasso",function(){this.__lasso.hoverSelect=!0}),i.start()}function l(){var t,n;"touchmove"===d3.event.sourceEvent.type?(t=d3.event.sourceEvent.touches[0].clientX,n=d3.event.sourceEvent.touches[0].clientY):(t=d3.event.sourceEvent.clientX,n=d3.event.sourceEvent.clientY);var s=d3.mouse(this)[0],u=d3.mouse(this)[1];""===h?(h=h+"M "+s+" "+u,v=[t,n],d=[s,
@zenorocha
zenorocha / etc-hosts-on-win.md
Last active April 11, 2024 23:07
/etc/hosts on Windows

1. Get your IP Address

echo `ifconfig $(netstat -nr | grep -e default -e "^0\.0\.0\.0" | head -1 | awk '{print $NF}') | grep -e "inet " | sed -e 's/.*inet //' -e 's/ .*//' -e 's/.*\://'`

2. Modify your hosts file

notepad

@ipbastola
ipbastola / clean-up-boot-partition-ubuntu.md
Last active May 2, 2024 01:27
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@ernestohs
ernestohs / alias.sh
Last active December 27, 2023 19:21
how lazy I am
alias push='git push origin $(git rev-parse --abbrev-ref HEAD)'
alias pull='git pull --recurse-submodules origin $(git rev-parse --abbrev-ref HEAD)'
alias s="git status -s"
alias c="git commit -m "
alias a='git add . && git status -s'
alias l='git log --oneline --all --graph --decorate'
alias gb='git fetch && git checkout '
alias undo='git checkout --'
alias reset='git reset --hard HEAD~1'
alias clean='git clean -dnx'
@e-schultz
e-schultz / app.ts
Created April 6, 2016 12:37
NG2 Modal
import {Component} from 'angular2/core';
import Modal from './modal';
@Component({
selector: 'ngc-app',
template: `
<div class="p3">
<p class="p4">
<button class="btn btn-primary block col-6 mx-auto"
(click)="showModal()">
@plablo09
plablo09 / README.md
Last active July 5, 2017 09:30
Cartograma simple

Cartograma Simple

Aquí puedes ver la implementación más sencilla de un cartograma en d3.js. Lo único que hace el script es crear un mapa base y actualizar los polígonos de acuerdo al valor de una variable escalada

@soufianeEL
soufianeEL / laravel.js
Last active June 18, 2023 05:25 — forked from JeffreyWay/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Exemples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
*/
(function() {
@chantastic
chantastic / on-jsx.markdown
Last active March 20, 2024 01:03
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@maxwihlborg
maxwihlborg / debounce.js
Created March 1, 2015 15:17
Simple javascript debounce function used when bundling up function calls.
/**
* Simple debounce function; usage:
*
* Create a function that only can be called once every 500 ms
*
* var df = debounce(function() {
* ... func body ...
* }, 500)
*
* Bind the function to an event
@leonardorame
leonardorame / ngAdmin Login
Created February 9, 2015 18:37
ng-admin login
/*
Small ng-admin config showing how to inject a Login controller when
a 401 error is returned by the server.
*/
(function () {
"use strict";
var app = angular.module('myApp', [