Skip to content

Instantly share code, notes, and snippets.

View onliniak's full-sized avatar

Rafael Pszenny onliniak

View GitHub Profile
@onliniak
onliniak / camera.kt
Last active March 22, 2022 09:24
Android Compose Jetpack
package io.github.onliniak.qr_scanner
import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.result.launch
import androidx.compose.material.Button
@onliniak
onliniak / math.js
Created January 22, 2021 11:36
Prosty kalkulator
let obliczenia = 0;
math = {}
math.dodaj = 5
math.razy = 3
function oblicz(matm) {
sort = Object.entries(matm).sort((k, v) => k[0].localeCompare(v[0]));
for (i = 0; i < sort.length; i++) {
switch (sort[i][0]) {
case "dodaj":
@onliniak
onliniak / menus.js
Created December 10, 2020 21:54
1.5KB YAML to menu
const str =
`Category1:
name1: link1
name2: link2
name3: link3
name4: link4
Category2:
another_name1: betterLink
another_name2: betterLink2
another_name3: betterLink3`
@onliniak
onliniak / router.php
Created November 26, 2020 13:47
Naive PHP Router
<?php
function createRoutes(){
$routes = array();
array_push($routes, ['hello' => hello()]);
array_push($routes, ['hello123' => hello123()]);
return $routes;
}
function hello(){
return 'Hello World !';
@onliniak
onliniak / regex.js
Created November 25, 2020 22:31
Repeated Regex
const str =
`A:
a: 1
c: 3
b: 9
f: 3
B:
a: 3
c: 5
s: 4`
@onliniak
onliniak / new.rb
Created November 11, 2020 15:51
Unecessary refactorization?
class Parser
def initialize
@templates = {}
@definitions = {}
prepare_templates
prepare_methods
delegate
end
@onliniak
onliniak / app.cr
Created October 4, 2020 15:02
Crystal router 2.0
require "./router.cr"
server = HTTP::Server.new(Router.new)
server.bind_tcp "127.0.0.1", 8080
server.listen
@onliniak
onliniak / bash
Created September 30, 2020 16:11
Curl DDOS
for x in {1..100000}; do time curl http://0.0.0.0:8080/ ; done ;
@onliniak
onliniak / greeting.ecr
Last active September 30, 2020 15:50
Simple Crystal router
Greeting, <%= @name %>!
@onliniak
onliniak / shell
Created September 25, 2020 16:27
CodeIgniter localhost to ngrok
php spark serve -host 0.0.0.0 -port 4000
ngrok http 0.0.0.0:4000
Inspired by Passenger Phusion Server