Skip to content

Instantly share code, notes, and snippets.

View Masa331's full-sized avatar
🤠

Premysl Donat Masa331

🤠
View GitHub Profile
@Masa331
Masa331 / spec.json
Last active October 25, 2022 13:01
Vega-Lite spec from Tue Oct 25 2022
{
"config": { "customFormatTypes": true },
"width": { "step": 20 },
"data": {
"values": [{"date":"2022-10-01","duration":0},{"date":"2022-10-02", "duration":0},{"date":"2022-10-03","duration":3},{"date":"2022-10-04","duration":6},{"date":"2022-10-05","duration":10},{"date":"2022-10-06","duration":12},{"date":"2022-10-07","duration":11},{"date":"2022-10-08","duration":0},{"date":"2022-10-09","duration":0},{"date":"2022-10-10","duration":6},{"date":"2022-10-11","duration":7},{"date":"2022-10-12","duration":10},{"date":"2022-10-13","duration":17},{"date":"2022-10-14","duration":10},{"date":"2022-10-15","duration":0},{"date":"2022-10-16","duration":2},{"date":"2022-10-17","duration":3},{"date":"2022-10-18","duration":11},{"date":"2022-10-19","duration":3},{"date":"2022-10-20","duration":19},{"date":"2022-10-21","duration":15},{"date":"2022-10-22","duration":0},{"date":"2022-10-23","duration":0},{"date":"2022-10-24","duration":4},{"date":"2022-10-25","duration":0},{"date":"2022-10-26","duration":
@Masa331
Masa331 / tag_hierarchy.rb
Last active September 19, 2020 13:48
Grouping text entries by associated tags into hierarchical structure by theirs occurence across entries
#!/usr/bin/env ruby
# Following is a code which groups some entries hierarchically by it's tags composition. The hierarchy is determined by tag occurence in other entries.
require 'pry'
# entry = [id, some text description, array of tags]
entries = [
[1, 'lorem ipsum', ['#customer_x', '#administration', '#paperwork']],
[2, 'lorem ipsum', ['#customer_x', '#development']],
console.log('your page plugins are: ', pp.plugins);
console.log('Hello world from Gist!');
@Masa331
Masa331 / unused_css.rb
Last active June 6, 2020 15:47
Find unused css
css = File.read 'app/assets/stylesheets/new_web/app.css'
classes = css.scan /(?<=\.)[a-z][\w_-]+/
code = Dir.glob('app/views/static_pages/*').unshift 'app/views/layouts/new_web.html.erb'
code = code + Dir.glob('app/assets/javascripts/new_web/*')
markups = code.map { File.read _1 }
unused = classes.select do |css_class|
markups.none? { _1.include? css_class }
################################################################################
################# Arch Linux mirrorlist generated by Reflector #################
################################################################################
# With: reflector -l 30 -p http -f 20 --save /etc/pacman.d/mirrorlist
# When: 2015-03-28 05:01:51 UTC
# From: https://www.archlinux.org/mirrors/status/json/
# Retrieved: 2015-03-28 05:01:40 UTC
# Last Check: 2015-03-28 04:57:17 UTC
@Masa331
Masa331 / get_documents.rb
Last active October 19, 2018 14:45
Download all uploaded documents from UOL accounting api
#!/usr/bin/env ruby
require 'net/http'
require 'json'
def fetch(uri, token)
uri = URI(uri)
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
request = Net::HTTP::Get.new(uri)
@Masa331
Masa331 / Fund.sol
Created September 12, 2018 13:55
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.24;
contract Fund {
address public owner;
address public exec;
constructor() public {
owner = msg.sender;
}
@Masa331
Masa331 / ENS.sol
Created August 1, 2018 13:15
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=false&gist=
pragma solidity ^0.4.18;
interface ENS {
// Logged when the owner of a node assigns a new owner to a subnode.
event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
// Logged when the owner of a node transfers ownership to a new account.
event Transfer(bytes32 indexed node, address owner);
@Masa331
Masa331 / Second.sol
Last active August 1, 2018 12:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=true&gist=
pragma solidity ^0.4.0;
contract Ballot {
string public message;
string public message42;
}