Skip to content

Instantly share code, notes, and snippets.

View shvahabi's full-sized avatar
🎯
Focusing

Shahed shvahabi

🎯
Focusing
  • Earth
View GitHub Profile
@armamini
armamini / README.md
Last active February 15, 2026 20:49
Implement a reliable connection over Websocket via Cloudflare Workers

ساخت با Cloudflare Workers

این راهنما به شما کمک می‌کند تا بدون هزینه و سرور مجازی، یک کانفیگ شخصی با سرعت بالا و پینگ مناسب روی زیرساخت کلادفلر بسازید. (V2Ray over Websocket)


📋 پیش‌نیازها

  1. اکانت Cloudflare: نیاز به یک ایمیل موقت دارید.
  2. کد اسکریپت: کدی که باید در ورکر قرار دهید (موجود در فایل‌های این مخزن).
  3. UUID: یک کد یکتا که به عنوان رمز عبور عمل می‌کند.
How to make Android apps without IDE from command line
A HelloWorld without Android Studio
Update: I’ve made a new course that explain how you can avoid Android Studio and Gradle, but still use IntelliJ iDE:
Hello everybody!
In this tutorial, I will show you how you can build/compile an APK (an Android app) from your java code using terminal (on Linux) without IDE or in other words without Android Studio. At the end, I will also show you a script to automate the process. In this example, I will use Android API 19 (4.4 Kitkat) to make a simple HelloWorld. I want to say that I will do this tutorial without android command which is deprecated.
1. Install Java
@patmandenver
patmandenver / install_java_scala_sbt.sh
Last active April 15, 2021 16:30
Script to install Oracle Java 1.8, Scala 2.11.7 and sbt 0.13.9 on Ubuntu 14.04
#!/bin/bash
#
# Script to Install
# Oracle Java 1.8
# Scala 2.11.7
# sbt 0.13.9
#
##############################
#Script must be run as root/sudo
@ramn
ramn / scala_as_script.bash
Created April 10, 2015 15:14
Scala as script (shebang header)
#!/bin/bash
CP="$(find $HOME/.ivy2 -path '*myorg/*util_2.11-*.jar' | tail -1)"
exec scala -savecompiled -cp "$CP" $0 $@
!#
import com.myorg.MyClass
io.Source.stdin
.getLines
.map { line =>
@ramn
ramn / DerbyDbExample.scala
Created March 16, 2015 23:30
Start / connect to Derby example
// scala -cp $HOME/lib/derby-10.11.1.1.jar:$HOME/lib/derbyclient-10.11.1.1.jar:$HOME/lib/derbynet-10.11.1.1.jar
import org.apache.derby.drda.NetworkServerControl
import java.net.InetAddress
import java.sql.DriverManager
val server = new NetworkServerControl(InetAddress.getByName("localhost"),1527)
server.start(new java.io.PrintWriter(Console.out)) // here we direct logging to stdout
// To create and connect to a db in the same jvm:
@maximn
maximn / java-adapter-general.java
Last active November 26, 2020 23:32
Scala adapter pattern - maxondev.com
public interface Adaptee {
void doAdaptee();
}
public interface Adaptor {
void doAdaptor();
}
class Client{
private final Adaptor adaptor;
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.

@felipeborges
felipeborges / WebkitSample.js
Last active August 26, 2024 14:23
JavaScript (Gjs)(GTK3) Webkit Sample. Run: "gjs WebkitSample.js"
// Updated in August 2022
imports.gi.versions.Gtk = '3.0';
const { Gtk, GObject, WebKit2: WebKit } = imports.gi;
Gtk.init(null);
const WebBrowser = GObject.registerClass(
class WebBrowser extends Gtk.Application {
@seratch
seratch / 1_preparing_data.scala
Last active June 28, 2022 07:55
ScalikeJDBC powerful SQLSyntaxSupport example
import scalikejdbc._
import scalikejdbc.SQLInterpolation._
// load settings
Class.forName("org.hsqldb.jdbc.JDBCDriver")
ConnectionPool.singleton("jdbc:hsqldb:mem:test", "", "")
GlobalSettings.loggingSQLAndTime = LoggingSQLAndTimeSettings(enabled = true, logLevel = 'info)
implicit val session = AutoSession