Skip to content

Instantly share code, notes, and snippets.

View onliniak's full-sized avatar

Rafael Pszenny onliniak

View GitHub Profile
@onliniak
onliniak / .cirrus.yml
Last active April 9, 2020 23:33
[FreeBSD] Build Crystal app with Cirrus CI
# https://cirrus-ci.com/task/4647371069980672
#
# Create static binary on FreeBSD
# Default FreeBSD's openssl = bug, build new version from source
#
# crystal + openssl + pkgconf = dependencies required to build.
# shards = package manager
# gmake = because I don't like standard Makefile
# Warning: When I try make std_spec compiler_spec on virtual machine with 2 threads of Ryzen5 1600 and 4gb ram, it killed my virtual machine.
#
@onliniak
onliniak / lista.md
Created April 7, 2020 13:01
Instalacja dowolnego programu w MyDevil.net

Ct8.pl to prawdopodobnie jedyny darmowy hosting z SSH. Można to wykorzystać do instalacji swojego oprogramowania, np compilatora Crystal.

Jeśli Twój program wymaga zbudowania ze źródeł, dodaj dodatkowy parametr --prefix np:

./configure --prefix=$HOME/katalog

Jeśli jednak wiesz, że paczka jest obecna w systemie ale nie masz roota to podaj: freebsd-version ← żeby odkryć jaką wersję FreeBSD mają zainstalowaną, u mnie było 11.3

@onliniak
onliniak / android.kt
Last active January 14, 2020 20:37
GET HTTP request in Kotlin Android
import java.net.URL
import java.lang.Thread as Thread1
Thread1 {
var a = URL("http://hmkcode-api.appspot.com/rest/api/hello/Android").readText()
runOnUiThread {
textView4.text = a
}
}.start()
@onliniak
onliniak / index.css
Last active December 10, 2019 23:22
Prepare for new calendar
.newEvent{
background-color:blue;
width:20px;
height:20px;
display:block;
position:absolute;
}
#hours{
background-color: rebeccapurple;
@onliniak
onliniak / index.js
Created December 6, 2019 19:43
JavaScript local date/time
new Date() //Date Fri Dec 06 2019 19:37:31 GMT+0000
new Date().toLocaleTimeString() //"19:36:29"
new Date().toLocaleDateString() //"6.12.2019"
new Date().toLocaleTimeString('en-US') //"7:39:12 PM"
new Date().toLocaleTimeString('en-US' ,{hour: '2-digit'}) //"7 PM"
@onliniak
onliniak / check.php
Last active December 6, 2019 19:49
Something like WP-nonce for AJAX authentication.
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php';
global $wpdb;
// Set timezone
date_default_timezone_set('Europe/Warsaw');
$select = file_get_contents('php://input');
$decode = json_decode($select, true);
@onliniak
onliniak / index.js
Created December 5, 2019 21:53
Javascript ES6 create new object
let gist = 'GitHub'
object = new Object();
object.ID = 1
object.name = 'me'
object.gist = gist
//{
// "ID": 1,
// "name": "me",
@onliniak
onliniak / index.js
Created December 5, 2019 21:47
[Tui Calendar] Change events lenght + detect when user cover/overlay existed event. [Unfinished]
var Calendar = tui.Calendar;
var calendar = new Calendar('#calendar', {
defaultView: 'week',
taskView: false,
week: {
workweek: true // show only 5 days except for weekend
}
});
calendar.on('beforeCreateSchedule', function(event) {
@onliniak
onliniak / index.html
Created November 30, 2019 20:09
Flatpickr sample
<!DOCTYPE html>
<html lang="pl" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="https://npmcdn.com/[email protected]/dist/flatpickr.min.css">
<link rel="stylesheet" type="text/css" href="https://npmcdn.com/[email protected]/dist/themes/confetti.css">
<script src="https://npmcdn.com/[email protected]/dist/flatpickr.min.js" charset="utf-8"></script>
<script src="https://npmcdn.com/[email protected]/dist/l10n/pl.js"></script>
</head>
@onliniak
onliniak / guid.php
Last active November 28, 2019 23:11
WordPress as UUID4 Validator
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php';
$select = file_get_contents('php://input');
if(empty($select)) {
echo wp_generate_uuid4();
}else{
wp_is_uuid( $select, 4 );
echo 'UUID is correct';