Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<title>Easy Drag Demo</title>
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
<style type="text/css">
.container {
height: 250px;
width: 250px;
@calvine
calvine / Datatables_cookie_modifier.js
Last active August 29, 2015 14:11
This is a code snippit to modify how Datatables.net stores state information your cookie
@calvine
calvine / SpeechSynthesis_Explorer.html
Last active March 13, 2017 15:45
Exploring HTML 5 SpeechSynthesis! (TTS)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--
SpeechSysthesis Resource Links.
http://caniuse.com/#feat=speech-synthesis
https://www.w3.org/TR/speech-synthesis
@calvine
calvine / MainFragment.Java
Created December 3, 2018 05:47
Quick Android Example of Viewmodels and using them in databinding
package com.example.ui.main;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProviders;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
@calvine
calvine / svgtopng.bat
Created April 2, 2019 19:10
Using http://www.imagemagick.org tool to batch convert SVGs to PNGs
magick convert *.svg -set filename:f %t %[filename:f].png
@calvine
calvine / camelCaseConvert.js
Created April 7, 2019 18:34
This is a simple JS function that takes in a camel case string and converts it to a string with spaces between the works and each word capitalized.
/**
* Takes in a camel case string and splits and capitalizes each word.
* @param {String} propertyName
* @returns {String}
*/
static getDisplayNameFromPropertyName(propertyName) {
// Set the first character to upper case.
let displayName = propertyName.charAt(0).toUpperCase() + propertyName.slice(1).replace(/[A-Z]/g, " $&");
console.log(displayName);
return displayName;
from gpiozero import LED, Button
from time import sleep
from signal import pause
led_green = LED(2)
led_yellow = LED(3)
led_red = LED(4)
button = Button(14)
@calvine
calvine / publish.ps1
Created October 23, 2019 02:52
dotnet 3.0 single file publish command
dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true
# neo4j
docker run -p 7474:7474 -p 7687:7687 --env=NEO4J_AUTH=none --name neo4j -v C:\\neo4j\\data:/data neo4j
#mongodb
docker container run -p 27017:27017 --name mongodb -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_ROOT_PASSWORD=password -e MONGO_INITDB_DATABASE=testdb -v mongovolume:/data/db mongo
docker container create --name mongo -p 27017:27017 --net test_network --env MONGO_INITDB_ROOT_USERNAME=root --env MONGO_INITDB_ROOT_PASSWORD=password --env MONGO_INITDB_DATABASE=testdb --volume mongo_storage:/data/db mongo:latest
@calvine
calvine / index.js
Created February 13, 2021 17:32
Integer to Roman Numeral in JavaScript
const {intToRoman} = require("./int-to-roman");
const input = process.argv[process.argv.length-1];
console.log(`${input} => ${intToRoman(input)}`);