Skip to content

Instantly share code, notes, and snippets.

View dbousamra's full-sized avatar

Dominic Bou-Samra dbousamra

  • Piccolo Health
  • Australia
View GitHub Profile
@dennemark
dennemark / combobox.tsx
Created February 21, 2023 14:12
chakra combobox
import { Box, Input, Stack, Divider} from '@chakra-ui/react'
import * as combobox from '@zag-js/combobox'
import { normalizeProps, useMachine } from '@zag-js/react'
import { useEffect, useId, useState } from 'react'
const comboboxData = [
{ label: "Zambia", code: "ZA" },
{ label: "Benin", code: "BN" },
//...
]
@habemus-papadum
habemus-papadum / main.swift
Last active July 17, 2024 11:16
Single File Swift 3 Gui Sample
// A reminder to myself on how to quickly create a throw away gui app on OSX (i.e. a single file,
// w/o relying on XCode project templates
//Notes: In general it is hard to know how to create a Cocoa based gui without using XCode.
//This issue has existed for both Objective-C and now Swift
//Furthermore, Swift<-->Cocoa syntax has changed dramatically over various Swift versions,
//making stackoverflow posts unreliable
//This file provides a template for creating a throw away gui app
@armand1m
armand1m / Dockerfile
Last active March 10, 2024 14:54
Yarn cache compatible Dockerfile
FROM alpine
RUN apk add --update --no-cache nodejs
RUN npm i -g yarn
ADD package.json yarn.lock /tmp/
ADD .yarn-cache.tgz /
RUN cd /tmp && yarn
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules
@ralfw
ralfw / Dockerfile
Created August 18, 2016 06:31
Roll your own Elm Docker container
# Build image with Node.js, Elm and Nginx
FROM debian:latest
# prepare
RUN apt-get -y update
RUN apt-get -y install apt-utils
# install curl, http://stackoverflow.com/questions/27273412/cannot-install-packages-inside-docker-ubuntu-image
RUN apt-get -y install curl
@manigandham
manigandham / rich-text-html-editors.md
Last active July 23, 2024 12:07
Rich text / HTML editors and frameworks

Strictly Frameworks

Abstracted Editors

These use separate document structures instead of HTML, some are more modular libraries than full editors

@davidallsopp
davidallsopp / Shrinking.scala
Last active January 30, 2024 13:25
Solutions to the ScalaCheck problem that shrinking failing values may generate invalid values, because the constraints of the generator are not respected. This is for using ScalaCheck from within ScalaTest.
import org.scalatest._
import prop._
import org.scalacheck.Arbitrary._
import org.scalacheck.Gen
/**
* Solutions to the ScalaCheck problem that shrinking failing values may generate
* invalid values, because the constraints of the generator are not respected.
*
* See also http://stackoverflow.com/questions/20037900/scalacheck-wont-properly-report-the-failing-case
@ble
ble / simple.scala
Last active May 23, 2018 05:59
Expression parser
package ble
import scala.language.implicitConversions
package object parsimple {
import scala.util.parsing.combinator.{ JavaTokenParsers, ImplicitConversions }
import scala.util.parsing.input.CharSequenceReader
implicit def promoteToReader(cs: CharSequence): CharSequenceReader = new CharSequenceReader(cs)
@twilson63
twilson63 / app.js
Created September 5, 2012 02:17
AngularJS Contact Form Example
function ContactCtrl($scope, $http) {
$scope.success = false;
$scope.httpError = false;
$scope.send = function() {
var job = { job: { klass: 'msg', args: [$scope.msg]}};
$http.post('/contact',job).
success(function(data){
$scope.success = true;
$scope.msg = {};
@osa1
osa1 / Lexer.hs
Created August 29, 2012 05:03
separated lexing and parsing stages in parsec
module Lexer
( Token(..)
, TokenPos
, tokenize
) where
import Text.ParserCombinators.Parsec hiding (token, tokens)
import Control.Applicative ((<*), (*>), (<$>), (<*>))
data Token = Ide String
@thinkerbot
thinkerbot / public_enc_example.sh
Created November 19, 2010 04:56
Public-key encryption example using OpenSSL
#!/bin/bash
#
# Public-Key Encryption and Decryption
# * http://www.openssl.org/
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/
#
# Mac OS X 10.6.4
# OpenSSL 0.9.8l 5 Nov 2009
# Generate keys