Skip to content

Instantly share code, notes, and snippets.

View iketiunn's full-sized avatar

ike iketiunn

View GitHub Profile
@giventofly
giventofly / timeago.js
Created April 21, 2021 00:15
javascript time ago
const timeAgo = (unixtime)=>{
//no weeks
const periods = ["second", "minute", "hour", "day", "month", "year", "decade"];
const lengths = ["60","60","24","31","12","10"];
//js returns in ms instead of s
const now = Math.round(Date.now() / 1000);
let difference = now - unixtime;
let j=0;
for(j = 0; difference >= lengths[j] && j < lengths.length-1; j++) {
difference = difference / lengths[j];
@its-dibo
its-dibo / google-cloud-shell.md
Last active August 1, 2022 01:36
customizing Google cloud shell

to customize Google cloud shell, modify on of the following files:

  • $HOME/.customize_environment
  • $HOME/.profile
  • $HOME/.bashrc

notes

  • .customize_environment runs once when google shell instance boots up,
  • .profile, .bashrc run once for each shell login, i.e: when a new shell opened they will run, use to customise the shell prompt or to add environments.
@giacomocerquone
giacomocerquone / adbCommands.txt
Last active April 17, 2024 20:54
Useful adb logcat commands when working with react native
// useful to debug js code errors
adb logcat "*:S" ReactNative:V ReactNativeJS:V
// useful to debug native errors (when the app won't even start)
adb logcat "*:E"
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active July 20, 2024 05:29
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@duluca
duluca / npm-scripts-for-docker.md
Last active July 22, 2024 08:54
npm scripts for Docker

These are generic npm scripts that you can copy & paste into your package.json file as-is and get access to convinience scripts to manage your Docker images all in one place.

How to Use

npm i -g mrm-task-npm-docker
npx mrm npm-docker

Contribute

Here's the code repository https://github.com/expertly-simple/mrm-task-npm-docker

@hmartiro
hmartiro / zeromq-vs-redis.md
Last active June 17, 2024 14:04
Comparison of ZeroMQ and Redis for a robot control platform

ZeroMQ vs Redis

This document is research for the selection of a communication platform for robot-net.

Goal

The purpose of this component is to enable rapid, reliable, and elegant communication between the various nodes of the network, including controllers, sensors, and actuators (robot drivers). It will act as the core of robot-net to create a standardized infrastructure for robot control.

Requirements:

@faisalman
faisalman / baseConverter.js
Last active January 11, 2023 14:43
Convert From/To Binary/Decimal/Hexadecimal in JavaScript
/**
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript
* https://gist.github.com/faisalman
*
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com>
* Licensed under The MIT License
* http://www.opensource.org/licenses/mit-license
*/
(function(){
@kentbrew
kentbrew / node-on-ec2-port-80.md
Last active February 4, 2024 19:14
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);