Skip to content

Instantly share code, notes, and snippets.

View alilosoft's full-sized avatar
🐢

Ali Fellahi alilosoft

🐢
View GitHub Profile
@alilosoft
alilosoft / pg_pub_sub.rb
Created December 23, 2020 11:16 — forked from chsh/pg_pub_sub.rb
PostgreSQL LISTEN/NOTIFY example for ruby
#
# A:
# pubsub = PgPubSub.new('channelname')
# pubsub.subscribe do |data|
# puts "data: #{data} is coming!"
# end
#
# B:
# pubsub = PgPubSub.new('channelname')
# pubsub.publish("hello world")
build.gradle
apply plugin: "checkstyle"
checkstyle {
configFile = project(':').file("config/checkstyle/checkstyle.xml")
configProperties = ["suppressionFile" : project(':').file("config/checkstyle/suppressions.xml")]
toolVersion = "6.0"
}
@alilosoft
alilosoft / JavaFXTrayIconSample.java
Created August 21, 2020 15:58 — forked from jonyfs/JavaFXTrayIconSample.java
Demonstrate using the System Tray (AWT) to control a JavaFX application.
import javafx.application.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.*;
import javax.imageio.ImageIO;
import java.io.IOException;
package com.example.demo.app
import javafx.collections.ObservableList
import javafx.event.EventHandler
import javafx.scene.control.ComboBox
import javafx.scene.input.KeyCode
import javafx.scene.input.KeyEvent
fun <T> ComboBox<T>.makeAutocompletable() = AutoCompleteComboBoxExtension<T>(this)
@alilosoft
alilosoft / algebraic.ts
Created October 17, 2019 12:21 — forked from SimonAlling/algebraic.ts
Algebraic Data Types in TypeScript
// Types:
type Just<T> = { Just: T }
type Nothing = {}
type Maybe<T> = Just<T> | Nothing
type Left<L> = { Left: L }
type Right<R> = { Right: R }
type Either<L, R> = Left<L> | Right<R>
// For convenience:
@alilosoft
alilosoft / Aborted.java
Created April 9, 2019 23:11 — forked from nicolopignatelli/Aborted.java
Result micro-library. Emoji powered.
final class Aborted extends Failure {
public Result<T> ✅(Consumer<T> f) {
return this;
}
public Result<T> ❌(Consumer<ExceptionStack> f) {
return this;
}
}
@alilosoft
alilosoft / Application.kt
Created February 16, 2019 18:02 — forked from michael-simons/Application.kt
Minimal Kotlin/Gradle Example for Neo4j OGM
package so
import org.neo4j.ogm.annotation.GeneratedValue
import org.neo4j.ogm.annotation.Id
import org.neo4j.ogm.annotation.NodeEntity
import org.neo4j.ogm.annotation.Relationship
import org.neo4j.ogm.config.Configuration
import org.neo4j.ogm.session.SessionFactory
@NodeEntity