Skip to content

Instantly share code, notes, and snippets.

View varemenos's full-sized avatar

Adonis Kakoulidis varemenos

View GitHub Profile
@varemenos
varemenos / .hyper.js
Created December 7, 2016 09:55
hyper config
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// `BEAM` for |, `UNDERLINE` for _, `BLOCK` for █
cursorShape: 'BLOCK',
@varemenos
varemenos / _README.md
Last active June 25, 2017 22:16
Utilizing Array.prototype.reduce to replicate methods in Array's prototype

Reduce.js

This is an exercise and a challenge to see how far can I go with reduce and how many built-in Array methods I can replicate with it.

ToC

  1. concat
  2. every
  3. filter
  4. findIndex
@varemenos
varemenos / 1.fetch2base64.js
Last active March 10, 2022 22:31
Get an asset via the Fetch API and convert it to a base64 string
var path = 'http://adonisk.com/img/vlogo.jpg';
fetch(path).then(function (response) {
response.body.getReader().read().then(function(result) {
return btoa(String.fromCharCode.apply(null, result.value));
}).then(function(b64) {
console.log(b64);
});
});
@varemenos
varemenos / myfunc.js
Last active April 9, 2018 14:32
Sample Javascript module boilerplate
(function (root, name, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory;
} else {
root[name] = factory();
}
@varemenos
varemenos / 1.README.md
Last active February 13, 2024 14:00
Git log in JSON format

Get Git log in JSON format

git log --pretty=format:'{%n  "commit": "%H",%n  "abbreviated_commit": "%h",%n  "tree": "%T",%n  "abbreviated_tree": "%t",%n  "parent": "%P",%n  "abbreviated_parent": "%p",%n  "refs": "%D",%n  "encoding": "%e",%n  "subject": "%s",%n  "sanitized_subject_line": "%f",%n  "body": "%b",%n  "commit_notes": "%N",%n  "verification_flag": "%G?",%n  "signer": "%GS",%n  "signer_key": "%GK",%n  "author": {%n    "name": "%aN",%n    "email": "%aE",%n    "date": "%aD"%n  },%n  "commiter": {%n    "name": "%cN",%n    "email": "%cE",%n    "date": "%cD"%n  }%n},'

The only information that aren't fetched are:

  • %B: raw body (unwrapped subject and body)
  • %GG: raw verification message from GPG for a signed commit
These are the configuration and package-syncing files I'm using for my setup of the Atom Editor
@varemenos
varemenos / keybase.md
Created February 6, 2015 08:39
keybase proof

Keybase proof

I hereby claim:

  • I am varemenos on github.
  • I am adonisk (https://keybase.io/adonisk) on keybase.
  • I have a public key whose fingerprint is A79F C504 FB5A 2EC6 14DD B3D5 45A0 D777 A4D7 C545

To claim this, I am signing this object:

@varemenos
varemenos / logger.js
Created November 9, 2014 17:54
logger
var spacing = (function (size) {
var result = '';
for (var i = 0; i < size; i++) {
result += '&nbsp;';
}
return result;
})(4);
@varemenos
varemenos / ArrayMoveFunction.js
Created April 2, 2014 12:35
Function to move an Array item to another position of that Array
var t = [ 'a', 'b', 'c', 'd', 'e'];
Array.prototype.move = function (source, destination) {
// if source and destination are the same
if (source === destination) {
// then there is no need to move
return;
}
// if the source is smaller than 0 or the destination is larger than the size of the array
if (source < 0 || source > this.length - 1 || destination > this.length - 1) {
@varemenos
varemenos / oh-my-zsh-functions.zsh
Last active August 29, 2015 13:57
oh-my-zsh Functions
# creates a directory and cds into it
function mkd() {
mkdir -p "$@" && cd "$@"
}
# lists zombie processes
function zombie() {
ps aux | awk '{if ($8=="Z") { print $2 }}'
}