Skip to content

Instantly share code, notes, and snippets.

View Glutexo's full-sized avatar
🇨🇿
Wypili moją krew na hejnał

Glutexo Glutexo

🇨🇿
Wypili moją krew na hejnał
  • Frýdek, Czechia
View GitHub Profile
@Glutexo
Glutexo / update_ui.log
Last active June 19, 2018 12:22
ManageIQ rake update:ui log
➜ manageiq git:(master) ✗ bundle exec rake update:ui
** override_gem: manageiq-ui-classic, [{:path=>"/Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq-ui-classic"}], caller: /Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq/bundler.d/custom.rb
bower manageiq-ui-components#bower-dev not-cached https://github.com/ManageIQ/ui-components.git#bower-dev
bower manageiq-ui-components#bower-dev resolve https://github.com/ManageIQ/ui-components.git#bower-dev
bower spice-html5-bower#~1.7.2 cached https://github.com/himdel/spice-html5-bower.git#1.7.2
bower spice-html5-bower#~1.7.2 validate 1.7.2 against https://github.com/himdel/spice-html5-bower.git#~1.7.2
bower jquery.observe_field#~0.1.0 cached https://github.com/himdel/jquery.observe_field.git#0.1.0
bower jquery.observe_field#~0.1.0 validate 0.1.0 against https://github.com/himdel/jquery.observe_field.git#~0.1.0
bower angular-ui-sortable#~0.16.1 cached https://github.com/angula
@Glutexo
Glutexo / utf8_decode_demo.rb
Created May 17, 2018 07:11
Practical demo showing manual UTF-8 decoding
# Practical demo showing manual UTF-8 decoding. Ispired by an article by Tim Bray [Characters vs.
# Bytes](http://www.tbray.org/ongoing/When/200x/2003/04/26/UTF).
# These are characters mentioned in the article. Their UTF-8 represenation is written as an array of hex-encoded bytes.
utf8_chars = [
%w(26), # &
%w(D0 96), # Ж
%w(E4 B8 AD), # 中
%w(F0 90 8D 86) # 𐍆
]
@Glutexo
Glutexo / bash_escaped_path.rb
Created May 11, 2018 10:17
Converts non-ASCII chars of the current path to bash string entities
(File.realpath('.').each_char.map do |char| char.ascii_only? ? char : "\\u#{char.ord.to_s(16).rjust(4, '0')}" end).join
@Glutexo
Glutexo / stdout.log
Last active April 5, 2018 08:51
manageiq bundle exec rake update:ui fails
** override_gem: manageiq-providers-ansible_tower, [{:path=>"/Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq-providers-ansible_tower"}], caller: /Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq/bundler.d/custom.rb
** override_gem: ansible_tower_client, [{:path=>"/Users/stomsa/Vývoj/ManageIQ/Repozitáře/ansible_tower_client_ruby"}], caller: /Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq/bundler.d/custom.rb
** override_gem: manageiq-schema, [{:path=>"/Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq-schema"}], caller: /Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq/bundler.d/custom.rb
** override_gem: manageiq-ui-classic, [{:path=>"/Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq-ui-classic"}], caller: /Users/stomsa/Vývoj/ManageIQ/Repozitáře/manageiq/bundler.d/custom.rb
bower manageiq-ui-components#bower-dev not-cached https://github.com/ManageIQ/ui-components.git#bower-dev
bower manageiq-ui-components#bower-dev resolve https://github.com/ManageIQ/ui-components.git#bower-dev
bower jquery.observ
@Glutexo
Glutexo / orangeHRM.js
Last active July 1, 2020 08:16
OrangeHRM timesheet fill-out
// ==UserScript==
// @name OrangeHRM filler
// @version 1.0.0
// @description Simplifies OrangeHRM monthly timesheet submission
// @author Glutexo
// @homepage https://gist.github.com/Glutexo/c07cc56085a00d11906094597c97ff9d
// @match https://*.orangehrm.com/index.php/time/viewTimesheet/mode/my
// ==/UserScript==
/**
@Glutexo
Glutexo / Gemfile
Last active March 29, 2018 10:56
bundle update fail
raise "Ruby versions less than 2.3.1 are unsupported!" if RUBY_VERSION < "2.3.1"
source 'https://rubygems.org'
#
# VMDB specific gems
#
gem "manageiq-gems-pending", ">0", :require => 'manageiq-gems-pending', :git => "https://github.com/ManageIQ/manageiq-gems-pending.git", :branch => "master"
# Modified gems for gems-pending. Setting sources here since they are git references
@Glutexo
Glutexo / 0-not-working.php
Last active January 24, 2018 07:23
Demonstration of a strange PHP behavior concerning class definition order when nested traits are used
<?php
class MyClass
{
use MyFirstTrait;
}
// This does not work. MyFirstTrait should use MySecondTrait, "Fatal error:
// Trait 'MyFirstTrait' not found" is raised instead.
trait MyFirstTrait
@Glutexo
Glutexo / maybe.php
Created August 3, 2017 06:38
PHP class that allows method chaining even if some part of the chain returns null
<?php
class Maybe
{
/**
* @var mixed|null
*/
public $value;
@Glutexo
Glutexo / atom-keymap-fix.cson
Created March 1, 2017 16:03
Oprava Atomu, pokud v něm nejde napsat hvězdička *
# Pokud ti nejde v Atomu na Windows s českou klávenicí napsat hvězdička,
# zkus postupovat podle tohoto návodu:
#
# 1. V atomu zvol v nabídce File › Keymap…
# Otevře se ti textový soubor s hromadou šedého textu.
# 2. Na konec tohoto souboru vlož dva řádky uvedené na konci tohoto
# návodu.
# 3. Soubor ulož, například klávesovou zkratkou Ctrl-S.
#
# Teď už by mělo být možné napsat hvězdičku stiskem Ctrl-Alt-pomlčka,
@Glutexo
Glutexo / format-exponential.php
Created September 2, 2016 14:15
Converts an exponential (scientific) number notation to a decimal one using neither GMP nor BCMath module.
<?php
/**
* Converts an exponential (scientific) number notation to a decimal one.
* Uses neither GMP nor BCMath modules.
*
* @param float|int|string $value
* @return string
*/
function formatExponential($value) {
// Both upper-case “E” and lower-case “e” would work.