Skip to content

Instantly share code, notes, and snippets.

Shiyason yanshiyason

Block or report user

Report or block yanshiyason

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rename
#!/usr/bin/env bash
#
# Simple file and folder renaming utility.
#
# Makes use of the [sharkdp/fd](https://github.com/sharkdp/fd) find script
# to rename files and folders
#
# Usage example:
#
View phx_react_tutorial.md
  1. Generate phoenix app
$ mix phx.new phx_react
Fetch and install dependencies? [Yn] y
  1. Generate react app in the assets directory
View 1_qwerty.txt
// * ===== Colemak =====
// *
// * Kinesis Advantage 2 Colemak Layout File Copyright 2016 by Greg Dietsche.
// * Licensed under the MIT License.
// * See LICENSE file in the project root for full license information.
// *
// * Colemak was created by Shai Coleman and is in the Public Domain.
// *
// * Learn more about Colemak here: https://colemak.com/
// *
@yanshiyason
yanshiyason / reddit api docs (json)
Last active Oct 14, 2018
Parse the reddit API docs and return them as JSON
View reddit api docs (json)
require 'nokogiri'
require 'json'
html = `curl 'https://www.reddit.com/dev/api/' \
-H 'authority: www.reddit.com' \
-H 'cache-control: max-age=0' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' \
-H 'referer: https://www.google.co.jp/' \
View cypress_js_polling_function.js
// usage:
// cy.poll({
// fn: () => cy.request(...),
// until: response => response.body.count === 1,
// assertFn: response => expect(response.body).to.deep.eq({
// count: 1,
// }),
// timeout: 120000,
// interval: 10000,
// })
View laterintime.go
func laterInTime(days time.Duration, do func()) {
resetTime := func() {
jwt.TimeFunc = func() time.Time {
return time.Now()
}
}
defer resetTime()
jwt.TimeFunc = func() time.Time {
return time.Now().Add(time.Hour * 24 * days)
@yanshiyason
yanshiyason / du_sort.sh
Created Apr 2, 2019
disk usage with sort
View du_sort.sh
#!/bin/bash
du -sh * | gsort -h | tail -r --
View cob
#!/usr/bin/env ruby
# frozen_string_literal: true
# rubocop:disable Metrics/LineLength, Metrics/MethodLength
#
# _________ ________ __________
# \_ ___ \ \_____ \\______ \
# / \ \/ / | \| | _/
# \ \____/ | \ | \
# \______ /\_______ /______ /
You can’t perform that action at this time.