Skip to content

Instantly share code, notes, and snippets.

View lucasa's full-sized avatar

Lucas Alberto lucasa

View GitHub Profile
@mourner
mourner / TileLayer.Common.js
Created February 11, 2012 23:11
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@5263
5263 / blender-nurbs-selfcontained.py
Last active March 20, 2023 12:07
NURBS export for Blender and import for FreeCAD
#!/usr/bin/env python
freecadfunctions="""#!/usr/env/bin python
#python 2
import FreeCAD,Part
def pointstopoles1D(points):
return zip(*[(FreeCAD.Vector(point[0:3]),point[3]) for point in points])
def pointstopoles(points,cu):
poles=[]
@timo22345
timo22345 / flatten.js
Last active March 13, 2024 17:06
Flatten.js, general SVG flattener. Flattens transformations of SVG shapes and paths. All shapes and path commands are supported.
<!doctype html>
<html>
<title>Flatten.js, General SVG Flattener</title>
<head>
<script>
/*
Random path and shape generator, flattener test base: https://jsfiddle.net/fjm9423q/embedded/result/
Basic usage example: https://jsfiddle.net/nrjvmqur/embedded/result/
@bjmc
bjmc / install_sentry.sh
Created June 26, 2014 01:32
Basic setup script for installing Sentry (http://getsentry.com) + Redis on new Ubuntu 14.04 Amazon EC2 instance
#! /bin/bash
export RUN_AS='ubuntu';
export INSTALL_DIR='/var/www/sentry';
HOSTNAME='http://mysentry.example.com'; # No trailing slash
DB_HOST='something.rds.amazonaws.com';
DB_PORT='5432';
DB_USER='sentry';
DB_NAME='sentry';
DB_PASSWORD='DB_PASSWORD';
@cirocosta
cirocosta / DraggableSvgComp.jsx
Created January 29, 2015 13:38
Draggable React SVG Element
'use strict';
/**
* DraggableSvgComp ...
*/
const findSvgRoot = (DOMNode) =>
DOMNode.parentElement.localName === 'svg' ?
DOMNode.parentElement :
findSvgRoot(DOMNode.parentElement);

Interactive Machine Learning

Taught by Brad Knox at the MIT Media Lab in 2014. Course website. Lecture and visiting speaker notes.

@bergie
bergie / noflo.json
Last active August 18, 2018 22:13
Draggable demo
{
"caseSensitive": false,
"properties": {
"name": "Movable image",
"environment": {
"type": "noflo-browser",
"content": "<style>\n.area {\n width: 100%;\n height: 300px;\n user-select: none;\n}\n.draggable {\n -moz-user-select: none;\n -khtml-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n -khtml-user-drag: element;\n -webkit-user-drag: element;\n cursor: -webkit-grab;\n cursor: -moz-grab;\n cursor: grab;\n width: 40px;\n height: 40px;\n border-radius: 20px;\n background-color:hsl(220,20%,20%);\n box-shadow: \n 0 -1px 0px hsl(220,100%,100%),\n 0 1px 1px hsla(220,20%,0%,.2),\n 0 3px 8px hsla(220,20%,0%,.1);\n}\n.draggable:active {\n cursor: -webkit-grabbing;\n cursor: -moz-grabbing;\n cursor: grabbing;\n}\n</style>\n\n<div class=\"area\">\n <img class=\"draggable\" src=\"https://meemoo.org/hack-our-apps/shots/recursive.png\" draggable=\"true\">\n</div>"
},
"icon": ""
},
@AdaRoseCannon
AdaRoseCannon / HTMLElementPlus.js
Last active March 3, 2023 11:33
HTML Element Plus for Web Components
'use strict';
class HTMLElementPlus extends HTMLElement {
static defaultAttributeValue() {
/* the name of the attribute is parsed in as a parameter */
return;
}
static parseAttributeValue(name, value) {
@flying3615
flying3615 / prometheus-grafana.yml
Last active April 22, 2021 21:16
Orchestrate prometheus and grafana in docker container to monitor spring-acturator application
--------docker-compose.yml---------
version: '2'
services:
prometheus_cust:
image: prometheus_cust:openbet
networks:
- obnet
grafana_cust:
image: grafana/grafana
networks:
variables:
DB: 'pgsql'
PHP: '7.1'
BROWSER: 'chrome'
before_script:
- apt install git -y
- git clone --depth 1 https://github.com/moodlehq/moodle-docker.git $HOME/moodle-docker
- cd $HOME/moodle-docker
- export MOODLE_DOCKER_WWWROOT=$CI_PROJECT_DIR