Skip to content

Instantly share code, notes, and snippets.

Avatar
💎
Searching for Ruby gems

Beyar Beyarz

💎
Searching for Ruby gems
View GitHub Profile
View enum.swift
enum Scope {
case email
case fullName
}
class AuthRequest {
var requestedScopes: [Scope] = []
}
var request = AuthRequest()
View Holidays.json
{
"data": [
"2020-06-13",
"2020-06-14",
"2020-06-20",
"2020-06-21",
"2020-06-27",
"2020-06-28",
"2020-07-04",
"2020-07-05",
@Beyarz
Beyarz / strip.d
Created Jun 9, 2020
Convert Diet template to Html
View strip.d
import diet.html;
import std.stdio;
import vibe.http.server;
void translateDiet() {
auto file = File("public/index.html", "w");
auto dst = file.lockingTextWriter;
dst.compileHTMLDietFile!("index.dt", DefaultDietFilters);
writeln("Generated index.html.");
}
@Beyarz
Beyarz / serverless.rb
Created Jun 4, 2020
WEBrick::HTTPServlet::AbstractServlet with CORS enabled
View serverless.rb
require 'net/http'
Handler = Proc.new do |req, res|
coord = {
lat,
lon,
key
}
host = "https://api.openweathermap.org/data/2.5/onecall?lat=#{coord[:lat]}&lon=#{coord[:lon]}&appid=#{coord[:key]}"
View cheatsheet.md

Cheatsheet

Download single video

youtube-dl https://www.youtube.com/watch?v=ABC123

Download whole channel

youtube-dl -f best -ciw -o "%(title)s.%(ext)s" -v https://www.youtube.com/channel/ABC123

View regex.md

Regex cheatsheet

[^\s]+$

[Thu May 14 11:08:28 2020] 1.3.3.7 root emerald
[Thu May 14 11:08:29 2020] 1.3.3.7 root carrie
[Thu May 14 11:08:31 2020] 1.3.3.7 root wangfei
[Thu May 14 11:08:32 2020] 1.3.3.7 root a1314521
[Thu May 14 11:08:33 2020] 1.3.3.7 root australia
[Thu May 14 11:08:35 2020] 1.3.3.7 root john

@Beyarz
Beyarz / brew cleanup
Last active May 10, 2020
Error: Permission denied @ apply2files - /usr/local/share/ghostscript/9.27/Resource/CIDFSubst/ipaexg.ttf
View brew cleanup
sudo chown -R $(whoami) /usr/local/share
View js.js
// Run anonymous function on load
(() => console.log(1))()
@Beyarz
Beyarz / checker.js
Last active Apr 28, 2020
Checker for dubs, trips, quads, penta & further
View checker.js
function replyChecker() {
const repliesCount = document.getElementsByClassName('ts-replies')[0].innerText;
let dubs;
let postNum;
let counter = 0;
for(let x = 0; x <= repliesCount; x++) {
dubs = document.getElementsByClassName('postNum desktop')[x].childNodes[1].innerText.slice(-2).split('');
postNum = document.getElementsByClassName('postNum desktop')[x].childNodes[1].innerText;
if (dubs[0] == dubs[1]) {
console.log('>>' + postNum);
@Beyarz
Beyarz / periodic.rb
Last active Mar 18, 2020
Display your name by using acronyms from the periodic table
View periodic.rb
# frozen_string_literal: true
class Sys
def self.cls
system('clear') || system('cls')
end
end
atomic = File.read('table.txt').split(' ')
elements = []
You can’t perform that action at this time.