Skip to content

Instantly share code, notes, and snippets.

View avosa's full-sized avatar
🧡
Coding

avosa

🧡
Coding
  • San Francisco, CA
View GitHub Profile
@avosa
avosa / Activate Office 2019 for macOS VoL.md
Last active March 19, 2023 11:38 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

# Dynamically creating repetitive methods using Metaprogramming in Ruby
class Eat
meals = %w(lunch supper breakfast)
meals.each do |meal|
define_method("#{meal}_meal") do |args|
puts "I ate: #{args} for: #{meal}"
end
end
@avosa
avosa / rails http status codes
Created May 8, 2022 11:16 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@avosa
avosa / clean_code.md
Created October 4, 2021 08:33 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@avosa
avosa / timeInWords.js
Created September 26, 2021 14:33
A Nodejs implementation of time in strings
var now = new Date();
var seconds = now.getSeconds();
var minutes = now.getMinutes();
var hours = now.getHours();
var day = now.getDay();
var month = now.getMonth();
var year = now.getFullYear();
var days = [
"Sunday",
"Monday",
for Y in {2017..2020}
do
mkdir $Y
cd $Y
for M in {01..12}
do
mkdir $M
cd $M
for D in {01..31}
do

Keybase proof

I hereby claim:

  • I am avosa on github.
  • I am websteravosa (https://keybase.io/websteravosa) on keybase.
  • I have a public key ASB5NqOCH06BYlKTk-2JHTvAm09F6IcN8tTLfTPkChbfBwo

To claim this, I am signing this object:

@avosa
avosa / my.sh
Last active March 18, 2021 10:51
Some simple way to get copy newest file from dir using Unix script
#!/bin/bash
echo "Enter directory you want to copy latest file from"
read DEST
function checkForNewestFile(){
NEWEST=`ls -tr1d "${MY_DIR}/"*.${FILEEXT} 2>/dev/null | tail -1`
if [ -z "${NEWEST}" ] ; then
echo "No newest file to copy"
exit 1