Skip to content

Instantly share code, notes, and snippets.

View henryhamon's full-sized avatar
🏠
Working from home

Henry Hamon henryhamon

🏠
Working from home
View GitHub Profile
@henryhamon
henryhamon / dc.Game.TicTacToe.cls
Last active August 10, 2021 06:26
Tic Tac Toe for InterSystems Iris 2021.0PYTHON.237.0
/// TicTacToe Game Class
Class dc.Game.TicTacToe
{
/// Start a new Game match
ClassMethod Start()
{
Do ##class(TicTacToe.Engine).NewGame()
Write #
Write !,"Let's play Tic Tac Toe"
@henryhamon
henryhamon / CodeGolf.MagicTowel.cls
Created July 22, 2021 18:33
CodeGolf MagicTowel
Class CodeGolf.MagicTowel
{
ClassMethod AddWater(pill As %Integer) As %Integer
{
Quit ""
}
}
@henryhamon
henryhamon / CodeGolf.NatoTranslator.cls
Created July 1, 2021 00:39
Template and UnitTest to CodeGolf "If you can read this..."
Class CodeGolf.NatoTranslator
{
ClassMethod ToNato(strin As %String) As %String
{
Set strout = ""
// action
Quit strout
}
@henryhamon
henryhamon / utlXml.cls
Last active June 10, 2019 10:37
CorrelateXML
Class utl.Xml
{
ClassMethod CorrelateStream(pXMLStream As %CharacterStream, pClasse As %String, pTag As %String, Output pObjXML As %XML.Adaptor) As %Status
{
Set tSC = $$$OK
Try
{
@henryhamon
henryhamon / cacheobjectscript.json
Last active October 18, 2019 22:17
vscode cos snippets
{
"$$$ThrowOnError": {
"prefix": "toe",
"body": "$$$$THROWONERROR(tSC, $1)",
"description": "Throw On Error Macro"
},
"$TryCatch": {
"prefix": "$try",
"body": [
"Set tSC = $$$$OK",
@henryhamon
henryhamon / record.js
Created October 4, 2018 23:42
record cam and screen
const recordCamera = () => {
smallVideoType=1;
cleanRecord()
navigator.getUserMedia({
audio: false,
video: { mandatory: { minWidth: 50, minHeight: 50 } }
}, getMediaStream, getUserMediaError)
}
{
"editor.minimap.enabled": false,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
"diffEditor.ignoreTrimWhitespace": true,
"git.autofetch": true,
}
// I just write a finder to find templates,
func TemplatesFinder(engine *gin.Engine, pathOfRoot, templateDirName string) {
dir := gin.Dir(pathOfRoot, true)
file, err := dir.Open(templateDirName)
util.PanicError(err)
defer file.Close()
dirs, err := file.Readdir(10)
util.PanicError(err)
#include <Servo.h> //Servo motor library. This is standard library
#include <NewPing.h> //Ultrasonic sensor function library. You must install this library
//our L298N control pins
const int LeftMotorForward = 7;
const int LeftMotorBackward = 6;
const int RightMotorForward = 4;
const int RightMotorBackward = 5;
//sensor pins
sudo touch /etc/init.d/couchdb
# Standard Ubuntu Elixir installation instructions
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
sudo dpkg -i erlang-solutions_1.0_all.deb
sudo apt-get update
sudo apt-get -f install
sudo apt-get install elixir