This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Mail logging combined with OS X notification. | |
# Uses terminal-notifier – https://github.com/alloy/terminal-notifier. | |
# Writes the whole message with header to the file, timestamp included, | |
# and raises a system notification with the message subject. The log | |
# file (LOG_FILE variable) is opened in the Console app upon clicking | |
# on the notification. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'securerandom' | |
TARGET_FILE_NAME = "random-file.iso" | |
TARGET_FILE_SIZE = 4707319808 # DVD-RW | |
CHUNK_SIZE = 1000000 # 1 MB | |
file = File.new TARGET_FILE_NAME, 'w' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Uses ruby to encode JSON, watchman to watch for changes, git-big-picture to output the image. | |
# Can be improved by watching only file creation/deletion, since content changes are irrelevant. | |
CURRENT_PATH=`pwd` | |
JSON=`HEADS_PATH="$CURRENT_PATH/.git/logs/refs/heads" ruby -e "require 'json'; puts JSON.dump ENV['HEADS_PATH']"` | |
watchman -j <<-EOT | |
["watch", $JSON] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Reads a mail from stdin, saves it to a new timestamped file and raises | |
# an macOS system notification. Can be used with PHP by entering this | |
# scripts path as a sendmail_path PHP INI variable. If used this way, | |
# from a webserver PHP instalation, make sure that the _www user has | |
# sufficent rights to execute the script and to write to the DIR_PATH | |
# folder. Also note that Dir.home returns the current user’s homedir. | |
# That means that if run by _www, it would return /Library/WebServer. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Maybe | |
{ | |
/** | |
* @var mixed|null | |
*/ | |
public $value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyClass | |
{ | |
use MyFirstTrait; | |
} | |
// This does not work. MyFirstTrait should use MySecondTrait, "Fatal error: | |
// Trait 'MyFirstTrait' not found" is raised instead. | |
trait MyFirstTrait |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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== | |
/** |