Skip to content

Instantly share code, notes, and snippets.

@omept
omept / short-number-format.php
Created May 21, 2019 07:08 — forked from RadGH/short-number-format.php
Short Number Formatter for PHP (1000 to 1k; 1m; 1b; 1t)
<?php
// Converts a number into a short version, eg: 1000 -> 1k
// Based on: http://stackoverflow.com/a/4371114
function number_format_short( $n, $precision = 1 ) {
if ($n < 900) {
// 0 - 900
$n_format = number_format($n, $precision);
$suffix = '';
} else if ($n < 900000) {
@omept
omept / command_base_structure.php
Last active February 5, 2020 10:36
my laravel command structure.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class MainCommand extends Command
{
/**
* The name and signature of the console command.
#steps
- copy your public ssh to clipboard
- make the .ssh directory if it doesn't exist
# mkdir -p ~/.ssh
- Create and open the ~/.ssh/authorized_keys file for editing using a terminal-based text editor, like nano
# nano ~/.ssh/authorized_keys
- Paste the contents of your SSH key into the file by right-clicking in your terminal and choosing Paste or by using a keyboard shortcut like CTRL+SHIFT+V. Then, save and close the file
@omept
omept / hello.go
Created February 12, 2020 22:08
hello world in go.
//first part
package main
// second part
import "fmt"
// third part
func main() {
var message string = myMessage() // Here I'm declaring a variable and naming it "message" and telling it the type of thing it must collect. Strings. The code below shows a great simple application that prints hello world to the screen
@omept
omept / docker-compose.yml
Created April 2, 2020 06:48 — forked from Mau5Machine/docker-compose.yml
Traefik Configuration and Setup
version: "3.3"
services:
################################################
#### Traefik Proxy Setup #####
###############################################
traefik:
image: traefik:v2.0
restart: always

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@omept
omept / .DS_Store
Last active October 13, 2020 09:43
BookingController (Refactor Task)
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const rowStyle = {
display: 'flex'
}
const squareStyle = {
'width':'60px',
'height':'60px',
@omept
omept / main.dart
Created March 21, 2022 17:05
Interface-like code review
void main() {
List<LogStructure> logEntries = [
App1Log("Mon 21 2022", "KTFFD"),
App2Log("Tues 21 2022", "MLDDD"),
];
print(logEntries);
}
@omept
omept / gasStationProblem.go
Last active July 14, 2022 07:50
Gas Station Problem
func Execute() {
gas := []int{1, 5, 3, 3, 5, 3, 1, 3, 4, 5}
cost := []int{5, 2, 2, 8, 2, 4, 2, 5, 1, 2}
tP := -1
for i := 0; i < len(gas); i++ {
if gas[i] > cost[i] {
rtTrnv := traverseScore(0, gas[i:], cost[i:])
if rtTrnv < 0 {