Blog

  • build-utility

    Build Utility

    Simple build utility for Unity

    Quick Start

    1. Open the Package Manager window in the Unity Editor.
    2. Click “Add package from git URL”.
    3. Type https://github.com/AndrewMJordan/build-utility.git#upm then press enter.

    Usage

    Invoke unity.exe and use the executeMethod option to execute the build utility:

    Andtech.BuildUtility.Builder.Build [-output <DIRECTORY] [-name <NAME>]
    

    Command Line

    1. Run unity.exe with the executeMethod option.
    > unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build
    
    1. Use the revision option if you want a revision string available in your build. For example, your CI/CD pipeline can include the commit hash in each build.
    > unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -revision ca82a6df
    
    1. Use the output option to build to the specified directory.
    > unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -output $HOME
    
    1. Use the name option to give an explicit name to your build. (If you omit the extension, an extension will automatically be added based on the build target)

    > unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -name MyBuild
    > unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -name MyAndroidApp.apk
    > unity.exe <PROJECT_PATH> -executeMethod Andtech.BuildUtility.Builder.Build -name MyAndroidApp
    
    1. Access the revision string via BuildVersioner.

    if (BuildVersioner.TryReadVersionFile(out var versionInfo)) {
    	string version = versionInfo.RawVersion;
    	string revision = versionInfo.Revision;
    
    	Debug.Log($"Build {version} (Revision: {revision})");
    }

    Version Label Sample

    1. From the Package Manager window, import the Version Label sample.
    2. Add the VersionLabel prefab to a canvas in your scene.
    3. When your project is build, version information will be displayed on-screen.

    Visit original content creator repository
    https://github.com/andtechstudios/build-utility

  • MinecraftServerPing

    Minecraft Server Ping

    Minecraft Server Ping est une API permettant de récupérer les informations d’un Serveur Minecraft grâce au Ping.

    Actuellement vous pouvez récuperez :

    ➳ Le favicon (Base64 encoded)
    ➳ Le nombre de joueurs
    ➳ La description du serveur (MOTD)
    ➳ La version du serveur
    ➳ La latence vers le serveur
    

    Minecraft Server Ping est compilé avec Gson-2.8.6
    Minecraft Server Ping est basé principalement sur le travail de zh32

    Configuration

    Vous devez utiliser la classe MinecraftServerPingOptions les options disponibles sont :

    • String hostname (hostname du serveur, obligatoire)
    • int port (port du serveur, optionnel par défaut 25565)
    • int timeout (socket timeout, optionnel par défaut 2000)
    • String charset (charset pour le MOTD, optionnel par défaut UTF-8)

    Exemple

    MinecraftServerPingInfos data = new MinecraftServerPing().getPing(new MinecraftServerPingOptions().setHostname("play.hypixel.net").setPort(25565));
    System.out.println(data.getDescription() + "\n" + data.getStrippedDescription() + "\n" + data.getVersion().getName() + "\n" + data.getLatency() + "ms\n" + data.getPlayers().getOnline() + "https://github.com/" + data.getPlayers().getMax());

    Documentation

    Vous pouvez aller voir la javadoc qui se trouve ici.
    Un exemple est disponible ici.

    Installation

    Remplacez %VERSION% avec les versions disponibles (1.0.0 & 2.0.0)

    Gradle

    repositories {
        mavenCentral() 
        maven {
            url "https://alwyn974.github.io/maven/"
        }
    }
    
    dependencies {
        compile 're.alwyn974.minecraftserverping:MinecraftServerPing:%VERSION%'
    }
    Visit original content creator repository https://github.com/alwyn974/MinecraftServerPing
  • Hecatoncheires

    Password Cracker

    Password cracker is an easy http/https multithreaded password cracker.
    This APP was created in order to bypass the router that my internet provider gave me. However, it can be use to bruteforce anything connected to internet.

    Args:

    • -p = path/password list
    • -u = username
    • -t = target (router’s ip)
    • -a = number of threads

    Installation:

    You must have python 3, a password list of any size and requests and argparse modules.

    1. Install dependencies:
    pip install requests argparse threading time sys
    1. Clone this repo:
    WhoAmI@wHOamI:~$ git clone https://github.com/LuizFritsch/router-cracker.git
    1. Access the repo directory and run it. e.g.:
    WhoAmI@wHOamI:~$ python cracker.py -p pwd-list.txt -u admin -t 192.168.0.1 -a 4

    Pré requisitos:

    • Python 3
    • Lista de senhas
    • Bibliotecas: requests, sys, argparse, time & threading

    Argumentos:

    • -p = diretorio/nome do arquivo contendo as senhas
    • -u = Nome de usuario
    • -t = target (ip do seu roteador, para acha-lo, execute ipconfig no win ou ifconfig no linux, e procure por gateway padrão)
    • -a = numero de threads

    Siga estes passos para executar o Router Cracker:

    1. Clone o repositório:
    WhoAmI@wHOamI:~$ git clone https://github.com/LuizFritsch/router-cracker.git
    1. Execute:
    WhoAmI@wHOamI:~$ python cracker.py -p pwd-list.txt -u admin -t 192.168.0.1 -a 4

    Visit original content creator repository
    https://github.com/LuizFritsch/Hecatoncheires

  • chroma-zh

    alecthomas/chroma explain translate-svg

    「 纯 Go 中的通用语法高亮显示器 」

    中文 | english


    校对 ✅

    翻译的原文 与日期 最新更新 更多
    commit ⏰ 2018-10-21 last 中文翻译

    贡献

    欢迎 👏 勘误/校对/更新贡献 😊 具体贡献请看

    生活

    If help, buy me coffee —— 营养跟不上了,给我来瓶营养快线吧! 💰


    Chroma – 纯 Go 中的通用语法高亮显示器 Build Status Gitter chat

    **注意:**由于 Chroma 刚刚发布,其 API 仍在不断变化.也就是说,高级接口应该不会发生太大变化.

    Chroma 采用源码和其他结构的文本,将其转换为语法高亮的 HTML,ANSI 色彩文本等.

    Chroma 很大程度上依赖于Pygments :python,包括 Pygments 的词法分析器-lexers样式-styles的转移.

    目录

    支持的语言

    字首 语言
    A ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Awk
    B Ballerina, Base Makefile, Bash, Batchfile, BlitzBasic, BNF, Brainfuck
    C C, C#, C++, Cassandra CQL, CFEngine3, cfstatement/ColdFusion, CMake, COBOL, CSS, Cap’n Proto, Ceylon, ChaiScript, Cheetah, Clojure, CoffeeScript, Common Lisp, Coq, Crystal, Cython
    D Dart, Diff, Django/Jinja, Docker, DTD
    E EBNF, Elixir, Elm, EmacsLisp, Erlang
    F Factor, Fish, Forth, Fortran, FSharp
    G GAS, GDScript, GLSL, Genshi, Genshi HTML, Genshi Text, Gnuplot, Go, Go HTML Template, Go Text Template, Groovy
    H Handlebars, Haskell, Haxe, Hexdump, HTML, HTTP, Hy
    I Idris, INI, Io
    J Java, JavaScript, JSON, Jsx, Julia, Jungle
    K Kotlin
    L Lighttpd configuration file, LLVM, Lua
    M Mako, Markdown, Mason, Mathematica, MiniZinc, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL
    N NASM, Newspeak, Nginx configuration file, Nim, Nix
    O Objective-C, OCaml, Octave, OpenSCAD, Org Mode
    P PacmanConf, Perl, PHP, Pig, PkgConfig, Plaintext, PL/pgSQL, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, Protocol Buffer, Puppet, Python, Python 3
    Q QBasic
    R R, Racket, Ragel, reg, reStructuredText, Rexx, Ruby, Rust
    S Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, Snobol, Solidity, SPARQL, SQL, SquidConf, Swift, systemd, Systemverilog
    T TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData
    V verilog, VHDL, VimL
    W WDTE
    X XML, Xorg
    Y YAML

    我将保持此部分的更新,但更及时与权威的列表在chroma --list.

    使用库

    与 Pygments 一样,Chroma 具有以下概念词法分析器-lexers,格式化-formatters款式-styles.

    Lexers 将源文本转换为标记流数据,styles 指定相应的标记类型如何映射到颜色,格式化程序将标记和 styles 转换为格式化输出.

    每个概念都有一个包,包含一个全局包Registry,其中具有所有已注册实现的变量。还有一些辅助函数可以让每个包都能使用注册表,例如按名称查找词法分析器,或匹配文件名等.

    在所有情况下,如果无法确定词法分析器,格式化程序或样式,nil将返回。在这种情况下,您可能希望默认为每个包中的Fallback值,此提供合理的默认值.

    让我们快速开始

    存在一个便利功能,可以用来简单格式一些源文本,而不需要任何努力:

    err := quick.Highlight(os.Stdout, someSourceCode, "go", "html", "monokai")

    识别语言

    要高亮代码,首先必须确定编写代码的语言.有三种主要方法:

    1. 从文件名中检测语言.

      lexer := lexers.Match("foo.go")
    2. 通过其 Chroma 语法 ID 明确指定语言(可从lexers.Names()中获取完整列表).

      lexer := lexers.Get("go")
    3. 从其内容中,分析语言.

      lexer := lexers.Analyse("package main\n\nfunc main()\n{\n}\n")

    在所有情况下,如果语言无法识别,返回一个nil.

    if lexer == nil {
      lexer = lexers.Fallback
    }

    在这一点上,应该指出一些词法分析者可能不尽如人意。为了缓解这种情况,您可以使用合并词法分析器,将相同标记类型的运行合并到一个标记中:

    lexer = chroma.Coalesce(lexer)

    格式化输出

    识别语言后,您需要选择格式化程序和样式(主题).

    style := styles.Get("swapoff")
    if style == nil {
      style = styles.Fallback
    }
    formatter := formatters.Get("html")
    if formatter == nil {
      formatter = formatters.Fallback
    }

    然后获取Token-标记上的迭代器:

    contents, err := ioutil.ReadAll(r)
    iterator, err := lexer.Tokenise(nil, string(contents))

    最后,从迭代器格式化标记:

    err := formatter.Format(w, style, iterator)

    HTML 格式化程序

    默认情况下,已注册的html格式化程序会生成带有嵌入式 CSS 的独立 HTML。更多的灵活性可以试试formatters/html包.

    首先,可以使用以下构造函数选项,自定义格式化程序生成的输出:

    • Standalone()– 使用嵌入式 CSS 生成独立 HTML.
    • WithClasses()– 使用类,而不是内联样式属性.
    • ClassPrefix(prefix)– 为每个生成的 CSS 类添加前缀.
    • TabWidth(width)– 以字符为单位设置渲染的标签宽度.
    • WithLineNumbers()– 渲染行号(LineNumbers样式).
    • HighlightLines(ranges)– 突出显示这些范围内的线条(LineHighlight样式).
    • LineNumbersInTable()– 使用table,来格式化行号和代码,而不是 span.

    如果是使用WithClasses(),可以从格式化程序中,获取相应的 CSS:

    formatter := html.New(html.WithClasses())
    err := formatter.WriteCSS(w, style)

    更多详情

    Lexers-词法分析器

    Pygments 文档有关实施词法分析器的详细信息.大多数概念直接适用于 Chroma,但请参阅现有的 lexer 实现,以获取实际示例.

    在许多情况下,可以使用附带的 Python 3 脚本pygments2chroma.py直接从 Pygments 那里,自动转换词法分析器。如下:

    python3 ~/Projects/chroma/_tools/pygments2chroma.py \
      pygments.lexers.jvm.KotlinLexer \
      > ~/Projects/chroma/lexers/kotlin.go \
      && gofmt -s -w ~/Projects/chroma/lexers/*.go
    

    pygments-lexers.go的笔记,其记录了有关词法分析器的列表,以及有关导入它们的一些问题的说明.

    格式化程序

    Chroma 支持 HTML 输出,以及 8 色,256 色和真彩色的终端输出.

    一个noop仅包含,输出标记文本的格式化程序,以及 一个tokensformatter 输出原始标记。后者对调试词法分析器非常有用.

    样式

    Chroma styles使用与Pygments相同的语法.

    所有 Pygments 样式都被_tools/style.py脚本转换为 Chroma的了.

    有关可用样式,及其外观的简易概述,请查看Chroma 主题画廊.

    命令行界面

    包括 Chroma 的命令行界面.它可以安装:

    go get -u github.com/alecthomas/chroma/cmd/chroma
    

    与 Pygments 相比有什么缺失?

    • 由于各种原因(欢迎提出请求),其中相当多的lexers:
      • Pygments对 复杂语言的词法分析器,通常包含处理某些方面的自定义代码,例如 Perl6 在正则表达式中嵌套代码的能力。这需要时间和精力来转换.
      • 我大多只转换我听过的语言,以降低移植成本.
    • 为简单起见,省略了 Pygments 的一些太深奥的功能.
    • 虽然 Chroma API 支持内容检测,但仅有少有语言支持。我计划在哪个时候实现一个统计分析仪,但时间不够.
    Visit original content creator repository https://github.com/chinanf-boy/chroma-zh
  • chroma-zh

    alecthomas/chroma explain translate-svg

    「 纯 Go 中的通用语法高亮显示器 」

    中文 | english


    校对 ✅

    翻译的原文 与日期 最新更新 更多
    commit ⏰ 2018-10-21 last 中文翻译

    贡献

    欢迎 👏 勘误/校对/更新贡献 😊 具体贡献请看

    生活

    If help, buy me coffee —— 营养跟不上了,给我来瓶营养快线吧! 💰


    Chroma – 纯 Go 中的通用语法高亮显示器 Build Status Gitter chat

    **注意:**由于 Chroma 刚刚发布,其 API 仍在不断变化.也就是说,高级接口应该不会发生太大变化.

    Chroma 采用源码和其他结构的文本,将其转换为语法高亮的 HTML,ANSI 色彩文本等.

    Chroma 很大程度上依赖于Pygments :python,包括 Pygments 的词法分析器-lexers样式-styles的转移.

    目录

    支持的语言

    字首 语言
    A ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Awk
    B Ballerina, Base Makefile, Bash, Batchfile, BlitzBasic, BNF, Brainfuck
    C C, C#, C++, Cassandra CQL, CFEngine3, cfstatement/ColdFusion, CMake, COBOL, CSS, Cap’n Proto, Ceylon, ChaiScript, Cheetah, Clojure, CoffeeScript, Common Lisp, Coq, Crystal, Cython
    D Dart, Diff, Django/Jinja, Docker, DTD
    E EBNF, Elixir, Elm, EmacsLisp, Erlang
    F Factor, Fish, Forth, Fortran, FSharp
    G GAS, GDScript, GLSL, Genshi, Genshi HTML, Genshi Text, Gnuplot, Go, Go HTML Template, Go Text Template, Groovy
    H Handlebars, Haskell, Haxe, Hexdump, HTML, HTTP, Hy
    I Idris, INI, Io
    J Java, JavaScript, JSON, Jsx, Julia, Jungle
    K Kotlin
    L Lighttpd configuration file, LLVM, Lua
    M Mako, Markdown, Mason, Mathematica, MiniZinc, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL
    N NASM, Newspeak, Nginx configuration file, Nim, Nix
    O Objective-C, OCaml, Octave, OpenSCAD, Org Mode
    P PacmanConf, Perl, PHP, Pig, PkgConfig, Plaintext, PL/pgSQL, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, Protocol Buffer, Puppet, Python, Python 3
    Q QBasic
    R R, Racket, Ragel, reg, reStructuredText, Rexx, Ruby, Rust
    S Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, Snobol, Solidity, SPARQL, SQL, SquidConf, Swift, systemd, Systemverilog
    T TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData
    V verilog, VHDL, VimL
    W WDTE
    X XML, Xorg
    Y YAML

    我将保持此部分的更新,但更及时与权威的列表在chroma --list.

    使用库

    与 Pygments 一样,Chroma 具有以下概念词法分析器-lexers,格式化-formatters款式-styles.

    Lexers 将源文本转换为标记流数据,styles 指定相应的标记类型如何映射到颜色,格式化程序将标记和 styles 转换为格式化输出.

    每个概念都有一个包,包含一个全局包Registry,其中具有所有已注册实现的变量。还有一些辅助函数可以让每个包都能使用注册表,例如按名称查找词法分析器,或匹配文件名等.

    在所有情况下,如果无法确定词法分析器,格式化程序或样式,nil将返回。在这种情况下,您可能希望默认为每个包中的Fallback值,此提供合理的默认值.

    让我们快速开始

    存在一个便利功能,可以用来简单格式一些源文本,而不需要任何努力:

    err := quick.Highlight(os.Stdout, someSourceCode, "go", "html", "monokai")

    识别语言

    要高亮代码,首先必须确定编写代码的语言.有三种主要方法:

    1. 从文件名中检测语言.

      lexer := lexers.Match("foo.go")
    2. 通过其 Chroma 语法 ID 明确指定语言(可从lexers.Names()中获取完整列表).

      lexer := lexers.Get("go")
    3. 从其内容中,分析语言.

      lexer := lexers.Analyse("package main\n\nfunc main()\n{\n}\n")

    在所有情况下,如果语言无法识别,返回一个nil.

    if lexer == nil {
      lexer = lexers.Fallback
    }

    在这一点上,应该指出一些词法分析者可能不尽如人意。为了缓解这种情况,您可以使用合并词法分析器,将相同标记类型的运行合并到一个标记中:

    lexer = chroma.Coalesce(lexer)

    格式化输出

    识别语言后,您需要选择格式化程序和样式(主题).

    style := styles.Get("swapoff")
    if style == nil {
      style = styles.Fallback
    }
    formatter := formatters.Get("html")
    if formatter == nil {
      formatter = formatters.Fallback
    }

    然后获取Token-标记上的迭代器:

    contents, err := ioutil.ReadAll(r)
    iterator, err := lexer.Tokenise(nil, string(contents))

    最后,从迭代器格式化标记:

    err := formatter.Format(w, style, iterator)

    HTML 格式化程序

    默认情况下,已注册的html格式化程序会生成带有嵌入式 CSS 的独立 HTML。更多的灵活性可以试试formatters/html包.

    首先,可以使用以下构造函数选项,自定义格式化程序生成的输出:

    • Standalone()– 使用嵌入式 CSS 生成独立 HTML.
    • WithClasses()– 使用类,而不是内联样式属性.
    • ClassPrefix(prefix)– 为每个生成的 CSS 类添加前缀.
    • TabWidth(width)– 以字符为单位设置渲染的标签宽度.
    • WithLineNumbers()– 渲染行号(LineNumbers样式).
    • HighlightLines(ranges)– 突出显示这些范围内的线条(LineHighlight样式).
    • LineNumbersInTable()– 使用table,来格式化行号和代码,而不是 span.

    如果是使用WithClasses(),可以从格式化程序中,获取相应的 CSS:

    formatter := html.New(html.WithClasses())
    err := formatter.WriteCSS(w, style)

    更多详情

    Lexers-词法分析器

    Pygments 文档有关实施词法分析器的详细信息.大多数概念直接适用于 Chroma,但请参阅现有的 lexer 实现,以获取实际示例.

    在许多情况下,可以使用附带的 Python 3 脚本pygments2chroma.py直接从 Pygments 那里,自动转换词法分析器。如下:

    python3 ~/Projects/chroma/_tools/pygments2chroma.py \
      pygments.lexers.jvm.KotlinLexer \
      > ~/Projects/chroma/lexers/kotlin.go \
      && gofmt -s -w ~/Projects/chroma/lexers/*.go
    

    pygments-lexers.go的笔记,其记录了有关词法分析器的列表,以及有关导入它们的一些问题的说明.

    格式化程序

    Chroma 支持 HTML 输出,以及 8 色,256 色和真彩色的终端输出.

    一个noop仅包含,输出标记文本的格式化程序,以及 一个tokensformatter 输出原始标记。后者对调试词法分析器非常有用.

    样式

    Chroma styles使用与Pygments相同的语法.

    所有 Pygments 样式都被_tools/style.py脚本转换为 Chroma的了.

    有关可用样式,及其外观的简易概述,请查看Chroma 主题画廊.

    命令行界面

    包括 Chroma 的命令行界面.它可以安装:

    go get -u github.com/alecthomas/chroma/cmd/chroma
    

    与 Pygments 相比有什么缺失?

    • 由于各种原因(欢迎提出请求),其中相当多的lexers:
      • Pygments对 复杂语言的词法分析器,通常包含处理某些方面的自定义代码,例如 Perl6 在正则表达式中嵌套代码的能力。这需要时间和精力来转换.
      • 我大多只转换我听过的语言,以降低移植成本.
    • 为简单起见,省略了 Pygments 的一些太深奥的功能.
    • 虽然 Chroma API 支持内容检测,但仅有少有语言支持。我计划在哪个时候实现一个统计分析仪,但时间不够.
    Visit original content creator repository https://github.com/chinanf-boy/chroma-zh
  • FoldingTabBar.iOS

    FoldingTabBar.iOS

    CocoaPods Compatible Carthage compatible

    Folding Tab Bar and Tab Bar Controller

    Inspired by this project on Dribbble

    Also, read how it was done in our blog

    Preview

    Requirements

    iOS 7.0

    Installation

    pod 'FoldingTabBar', '~> 1.2.1'
    github "Yalantis/FoldingTabBar.iOS" ~> 1.2.1
    

    Manual Installation

    Alternatively you can directly add all the source files from FoldingTabBar folder to your project.

    1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
    2. Open your project in Xcode, then drag and drop all the folder directories in FoldingTabBar folder onto your project (use the “Product Navigator view”). Make sure to select Copy items when asked if you extracted the code archive outside of your project.

    Introduction

    YALFoldingTabBarController

    YALFoldingTabBarController is a subclass of UITabBarController with custom animating YALFoldingTabBar.

    YALFoldingTabBar

    YALFoldingTabBar is a subclass of a standard UIView. We wanted to make this component expand and contract in response to a user tapping. When the component is closed you can only see a central button (“+”). When tapping on it, our custom Tab Bar expands letting other tabBarItems appear, so that the user can switch the controllers.

    Each separate tabBarItem can have two additional buttons on the left and right. These buttons can be used to let a user interact with a selected screen on the YALFoldingTabBarController without even having to leave it.

    YALTabBarItem

    YALTabBarItem is a model to configure your tab bar items with images.

    Usage

    Option 1: The simplest way is to use YALFoldingTabBarController as it is. You can also subclass it if you indend to change the default behaviour.

    Option 2: You can write your own implementation of UITabBarController and use YALFoldingTabBar or its subclass.

    Here is an instruction of how to use YALFoldingTabBarController in the Storyboard.

    1. Add native UITabBarController to the storyboard, establish relationships with its view controllers.
    2. Choose YALFoldingTabBarController as custom class for UITabBarController.
    3. Choose YALCustomHeightTabBar as custom class for UITabBar inside YALFoldingTabBarController
    4. In AppDelegate method take out an instance of YALFoldingTabBarController from the window.rootViewController and supply it with images for the left and right tabBarItems respectively. Also you can add your own image for the center button of YALFoldingTabBar.

    Objective-C

        YALFoldingTabBarController *tabBarController = (YALFoldingTabBarController *) self.window.rootViewController;
    
        //prepare leftBarItems
        YALTabBarItem *item1 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"nearby_icon"]
                                                          leftItemImage:nil
                                                         rightItemImage:nil];
        
        
        YALTabBarItem *item2 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"profile_icon"]
                                                          leftItemImage:[UIImage imageNamed:@"edit_icon"]
                                                         rightItemImage:nil];
        
        tabBarController.leftBarItems = @[item1, item2];
    
        //prepare rightBarItems
        YALTabBarItem *item3 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"chats_icon"]
                                                          leftItemImage:[UIImage imageNamed:@"search_icon"]
                                                         rightItemImage:[UIImage imageNamed:@"new_chat_icon"]];
        
        
        YALTabBarItem *item4 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"settings_icon"]
                                                          leftItemImage:nil
                                                         rightItemImage:nil];
        tabBarController.rightBarItems = @[item3, item4];
    

    Swift

        if let tabBarController = window?.rootViewController as? YALFoldingTabBarController {
    
            //leftBarItems
    
            let firstItem = YALTabBarItem(
                itemImage: UIImage(named: "nearby_icon")!,
                leftItemImage: nil,
                rightItemImage: nil
            )
    
            let secondItem = YALTabBarItem(
                itemImage: UIImage(named: "profile_icon")!,
                leftItemImage: UIImage(named: "edit_icon")!,
                rightItemImage: nil
            )
    
            tabBarController.leftBarItems = [firstItem, secondItem]
    
            //rightBarItems
    
            let thirdItem = YALTabBarItem(
                itemImage: UIImage(named: "chats_icon")!,
                leftItemImage: UIImage(named: "search_icon")!,
                rightItemImage: UIImage(named: "new_chat_icon")!
            )
    
            let forthItem = YALTabBarItem(
                itemImage: UIImage(named: "settings_icon")!,
                leftItemImage: nil,
                rightItemImage: nil
            )
    
            tabBarController.rightBarItems = [thirdItem, forthItem]
        }

    If you want to handle touches on extra tabBarItems import YALTabBarDelegate protocol to the subclass of the proper UIVIewController and implement these methods: ##Objective-C

    - (void)tabBarDidSelectExtraLeftItem:(YALFoldingTabBar *)tabBar;
    - (void)tabBarDidSelectExtraRightItem:(YALFoldingTabBar *)tabBar;

    Swift

    func tabBarDidSelectExtraLeftItem(tabBar: YALFoldingTabBar!)
    func tabBarDidSelectExtraRightItem(tabBar: YALFoldingTabBar!)

    If you want to handle touches on tabBarItems by indexes import YALTabBarDelegate protocol to the subclass of the proper UIVIewController and implement these methods:

    Objective-C

    - (void)tabBar:(YALFoldingTabBar *)tabBar didSelectItemAtIndex:(NSUInteger)index;
    - (BOOL)tabBar:(YALFoldingTabBar *)tabBar shouldSelectItemAtIndex:(NSUInteger)index;

    Swift

    func tabBar(tabBar: YALFoldingTabBar!, didSelectItemAtIndex index: UInt)
    func tabBar(tabBar: YALFoldingTabBar!, shouldSelectItemAtIndex index: UInt) -> Bool

    If you want to observe contracting and expanding animation states in YALFoldingTabBar the following methods of YALTabBarDelegate protocol can be implemented:

    Objective-C

    - (void)tabBarWillCollapse:(YALFoldingTabBar *)tabBar;
    - (void)tabBarWillExpand:(YALFoldingTabBar *)tabBar;
    
    - (void)tabBarDidCollapse:(YALFoldingTabBar *)tabBar;
    - (void)tabBarDidExpand:(YALFoldingTabBar *)tabBar;

    Swift

    func tabBarWillCollapse(tabBar: YALFoldingTabBar!)
    func tabBarWillExpand(tabBar: YALFoldingTabBar!)
    
    func tabBarDidCollapse(tabBar: YALFoldingTabBar!)
    func tabBarDidExpand(tabBar: YALFoldingTabBar!)

    Important notes

    Because we changed the height of the default UITabBar you should adjust your content to the bottom of viewcontroller’s superview, and ignore Bottom Layout Guide. You should also uncheck ‘Under bottom bars’ '

    You can see how we did it on the example project.

    Tips for customization

    You can make the following configurations for custom tabBar:

    1. Specify height

    Objective-C

    tabBarController.tabBarViewHeight = YALTabBarViewDefaultHeight;

    Swift

    tabBarController.tabBarViewHeight = YALTabBarViewDefaultHeight
    1. Specify insets and offsets

    Objective-C

        tabBarController.tabBarView.tabBarViewEdgeInsets = YALTabBarViewHDefaultEdgeInsets;
        tabBarController.tabBarView.tabBarItemsEdgeInsets = YALTabBarViewItemsDefaultEdgeInsets;
        tabBarController.tabBarView.offsetForExtraTabBarItems = YALForExtraTabBarItemsDefaultOffset;

    Swift

    tabBarController.tabBarView.tabBarViewEdgeInsets = YALTabBarViewHDefaultEdgeInsets
    tabBarController.tabBarView.tabBarItemsEdgeInsets = YALTabBarViewItemsDefaultEdgeInsets
    tabBarController.tabBarView.offsetForExtraTabBarItems = YALForExtraTabBarItemsDefaultOffset
    1. Specify colors

    Objective-C

        tabBarController.tabBarView.backgroundColor = [UIColor colorWithRed:94.0/255.0 green:91.0/255.0 blue:149.0/255.0 alpha:1];
        tabBarController.tabBarView.tabBarColor = [UIColor colorWithRed:72.0/255.0 green:211.0/255.0 blue:178.0/255.0 alpha:1];
        tabBarController.tabBarView.dotColor = [UIColor colorWithRed:94.0/255.0 green:91.0/255.0 blue:149.0/255.0 alpha:1];

    Swift

    tabBarController.tabBarView.backgroundColor = UIColor(
                                                      red: 94.0/255.0,
                                                      green: 91.0/255.0,
                                                      blue: 149.0/255.0,
                                                      alpha: 1
                                                  )
    
    tabBarController.tabBarView.tabBarColor = UIColor(
                                                  red: 72.0/255.0,
                                                  green: 211.0/255.0,
                                                  blue: 178.0/255.0,
                                                  alpha: 1
                                              )
    
    tabBarController.tabBarView.dotColor = UIColor(
                                               red: 94.0/255.0,
                                               green: 91.0/255.0,
                                               blue: 149.0/255.0,
                                               alpha: 1
                                           )
    1. Specify height for additional left and right buttons

    Objective-C

        tabBarController.tabBarView.extraTabBarItemHeight = YALExtraTabBarItemsDefaultHeight;

    Swift

    tabBarController.tabBarView.extraTabBarItemHeight = YALExtraTabBarItemsDefaultHeight

    Let us know!

    We’d be really happy if you sent us links to your projects where you use our component. Just send an email to github@yalantis.com And do let us know if you have any questions or suggestion regarding the animation.

    P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

    License

    The MIT License (MIT)
    
    Copyright © 2017 Yalantis
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
    
    Visit original content creator repository https://github.com/Yalantis/FoldingTabBar.iOS
  • ror-plantation-v2

    Git Repository with project form lectures is at: https://github.com/Inza/ror-plantation-v2

    Resources

    Model Diagram

    You can generate the UML diagram at: https://www.planttext.com/

    @startuml
    enum Difficulty {
      NORMAL
      NIGHTMARE
      HELL
    }
    
    Subject "1" <-- "n" Topic
    Subject "1" <-- "n" Test
    
    Topic "1" <-- "0..n" TopicAssignment
    Test "1" <-- "0..n" TopicAssignment
    
    Question "1" <-- "0..n" QuestionAssignment
    Test "1" <-- "0..n" QuestionAssignment
    
    Topic "1" <-- "n" Question
    Question "1" <-- "0..n" Answer
    Question "1" <-- "0..n" Difficulty
    
    StudyProgram "1" <-- "0..n" SubjectAssignment
    Subject "1" <-- "0..n" SubjectAssignment
    @enduml

    Ruby Installation Tutorial

    1. [MAC ONLY] Install Xcode from Mac App Store (you need build tools from it)
    2. [MAC ONLY] Install Homebrew https://brew.sh/
    3. [MAC ONLY] Install gpg brew install gpg
    4. [WINDOWS ONLY] Install Ruby and Rails from Rails Installer http://railsinstaller.org/
    5. [WINDOWS ONLY] Install Git for Windows https://git-for-windows.github.io/
    6. [MAC ONLY] Update Git for Mac brew install git
    7. [MAC & Linux ONLY] Install RVM https://rvm.io
    8. [MAC ONLY] Install Xcode Command Line Tools xcode-select --install
    9. [MAC & Linux ONLY] Install Ruby 2.4.2 by rvm install 2.4.2
    10. [MAC & Linux ONLY] Select the installed Ruby 2.4.2 in RVM and use it by default rvm use 2.4.2 --default
    11. [MAC & Linux ONLY] Install Bundler by gem install bundler
    12. [MAC & Linux ONLY] Install Rails by gem install rails
    13. We will be using Ruby 2.4.2 and Rails 5.1.4 (on Windows Ruby 2.3.3 and Rails 5.1)
    14. Go to folder where you would like to have the new app
    15. Create new Rails app by rails new my-app
    16. Go to the generate folder by cd my-app
    17. Type 2.4.2 into .ruby-version (create file called .ruby-version and type 2.4.2 into it – or 2.3.3 on Windows)
    18. Adjust Gemfile
    19. Install all new gems (ruby dependencies) by bundle install
    20. Run you app by rails server or rails s
    21. Open 0.0.0.0:3000 (on Mac/Linux) or localhost:3000 (on Windows) in your browser to see Rails homepage
    22. [If you cloned this git repository] Open 0.0.0.0:3000/tests or 127.0.0.1:3000/tests or localhost:3000/tests in your browser to see the generated tests administration

    Visit original content creator repository
    https://github.com/Inza/ror-plantation-v2

  • cucumber

    Cucumber testing framework for Rust

    crates.io Rust 1.87+ Unsafe Forbidden
    CI Rust docs

    An implementation of the Cucumber testing framework for Rust. Fully native, no external test runners or dependencies.

    Usage

    Describe testing scenarios in .feature files:

    Feature: Eating too much cucumbers may not be good for you
    
      Scenario: Eating a few isn't a problem
        Given Alice is hungry
        When she eats 3 cucumbers
        Then she is full

    Implement World trait and describe steps:

    use std::time::Duration;
    
    use cucumber::{World as _, given, then, when};
    use tokio::time::sleep;
    
    #[derive(Debug, Default, cucumber::World)]
    struct World {
        user: Option<String>,
        capacity: usize,
    }
    
    #[given(expr = "{word} is hungry")] // Cucumber Expression
    async fn someone_is_hungry(w: &mut World, user: String) {
        sleep(Duration::from_secs(2)).await;
    
        w.user = Some(user);
    }
    
    #[when(regex = r"^(?:he|she|they) eats? (\d+) cucumbers?$")]
    async fn eat_cucumbers(w: &mut World, count: usize) {
        sleep(Duration::from_secs(2)).await;
    
        w.capacity += count;
    
        assert!(w.capacity < 4, "{} exploded!", w.user.as_ref().unwrap());
    }
    
    #[then("she is full")]
    async fn is_full(w: &mut World) {
        sleep(Duration::from_secs(2)).await;
    
        assert_eq!(w.capacity, 3, "{} isn't full!", w.user.as_ref().unwrap());
    }
    
    #[tokio::main]
    async fn main() {
        World::run("tests/features/readme").await;
    }

    Add test to Cargo.toml:

    [[test]]
    name = "readme"
    harness = false  # allows Cucumber to print output instead of libtest

    For more examples check out the Book (current | edge).

    Cargo features

    Supporting crates

    The full gamut of Cucumber’s Gherkin language is implemented by the gherkin crate. Most features of the Gherkin language are parsed already and accessible via the relevant structs.

    Known issues

    • Scenario Outline is treated the same as Outline or Example in the parser (gherkin/#19).

    License

    This project is licensed under either of

    at your option.

    Visit original content creator repository https://github.com/cucumber-rs/cucumber
  • EventWinner

    EventWinner Smart Contract

    A Solidity smart contract implementation that demonstrates external contract interaction on the Ethereum blockchain.

    This is the answer to stackoverflow question: Error: cannot estimate gas; transaction may fail or may require manual gas limit (Sepolia test Network)

    Overview

    The EventWinner project showcases a smart contract that can interact with other contracts through their interfaces. It implements a pattern for making external calls to contracts that expose an attempt() function.

    Technical Stack

    • Solidity ^0.8.27
    • Hardhat
    • TypeScript
    • Ethers.js

    Contract Architecture

    EventWinner.sol

    The main contract contains:

    • Interface definition for target contracts
    • External function to interact with other contracts
    • Low-level call implementation for robust contract interaction

    Key Features

    • External contract interaction
    • Interface-based calling
    • Gas-efficient implementation
    • Error handling

    Usage

    The contract can be used to interact with any contract that implements the attempt() function:

    // Get contract instance
    const eventWinner = await EventWinner.deploy();
    
    // Call target contract
    await eventWinner.callWinner(targetContractAddress);

    Development

    1. Clone the repository
    git clone https://github.com/BTC415/EventWinner.git
    1. Install dependencies:
    npm install
    1. Compile contracts:
    npx hardhat compile
    1. Run deployment script:
    npx hardhat run scripts/deploy.ts --network sepolia

    Network support

    • Sepolia
    • Local hardhat Network

    License

    This project is licensed under the MIT License.

    Visit original content creator repository
    https://github.com/Fantasy-Guru/EventWinner

  • tinie.link

    tinie.link

    Tinie.link is a modern, performant link shortening application built for scale and performance.

    Overview

    Tinie utilizes the following technologies and services:

    Local Development

    To develop or test Tinie locally, follow this guide:

    • Install workspace dependencies: Install Bun & Docker.
    • Clone the repository: Run git clone https://github.com/IamSebastianDev/tinie.link.git to clone the repository.
    • Install package dependencies: Run bun install to install dependencies.
    • Add the environment file: Create a .env.local file in the workspace root and set the environment variables as shown in the .env.example file.
    • Start the cloudflare workers: Run bun run start:worker to start the worker. You might need to log in to your Cloudflare account. After authenticating, you can terminate this process again. (This step is only necessary the first time.)
    • Start the Databases: Run bun db:up & bun db:migrate:local to initialize the databases.
    • Start the Dev Mode using Turbo: Run bun dev to start all applications in dev mode.
    • Connect: Use Postman or the Browser to connect to the different services running on their respective ports.

    Architecture

    You can find the architecture diagram as well as the design document here: Excalidraw.

    Visit original content creator repository
    https://github.com/IamSebastianDev/tinie.link