Skip to content

Instantly share code, notes, and snippets.

View yaroslavche's full-sized avatar
:octocat:
=)

Yaroslav yaroslavche

:octocat:
=)
View GitHub Profile

Update

sudo zypper -n dup

GIT

sudo zypper -n install git-core
@yaroslavche
yaroslavche / nativescript_sidekick_local_opensuse.md
Last active September 15, 2018 15:36
NativeScript with Sidekick local builds on Opensuse Leap 15

Dockerfile

FROM opensuse/leap:latest

RUN zypper -n install wget

RUN wget -q https://updates.timedoctor.com/download/_production/tdlite/linux/timedoctorlite-setup-2.3.49-linux-x64.run -O ~/td.run &&\
    cd ~/ &&\
    chmod +x td.run
@yaroslavche
yaroslavche / create_stream_from_string.md
Last active January 18, 2024 15:06
PHP. Create a stream from a string

If you know the string is small use

$stream = fopen(sprintf('data://text/plain,%s', $string), 'r');
$result = stream_get_contents($stream);

data://

When passing plain string without base64 encoding, do not forget to pass the string through URLENCODE(), because PHP automatically urldecodes all entities inside passed string (and therefore all + get lost, all % entities will be converted to the corresponding characters).

If data is large - better use

@yaroslavche
yaroslavche / switch.lua
Created January 12, 2020 14:37
lua switch
local Switch = {
__tostring = function(self)
return string.format('%s (strict: %s)', tostring(self.expression), tostring(self.strict))
end
}
Switch.__index = Switch
function Switch:new(expression, strict)
if type(strict) ~= 'boolean' then strict = true end
local self = setmetatable({}, Switch)
#define ану_иди_сюда using namespace
#define сказал std
#define блять ;
#define нихуя int
#define стопе main()
#define типа {
#define факт bool
#define базарь cout <<
#define спроси cin >>
#define пиздато 1