Skip to content

Instantly share code, notes, and snippets.

View martin1122's full-sized avatar

Martin martin1122

View GitHub Profile

A zoomable heat map of stocks classified by sector. The size of the blocks is a function of the volume traded and the color shows the gains / loss.

Copyright © 2017-20, Sandhya Pillai - MIT License

@martin1122
martin1122 / gist:1a50ab0b75fef38d1f2d44caa3e892bc
Created May 3, 2022 06:08 — forked from antonrogov/gist:1216380
JavaScript Coding Guidelines

JavaScript Coding Guidelines

This is a set of coding conventions and rules for use in JavaScript programming. It is inspired by the Sun document Code Conventions for the Java Programming Language. It is heavily modified of course because JavaScript is not Java.

The long-term value of software to an organization is in direct proportion to the quality of the codebase. Over its lifetime, a program will be handled by many pairs of hands and eyes. If a program is able to clearly communicate its structure and characteristics, it is less likely that it will break when modified in the never-too-distant future.

Code conventions can help in reducing the brittleness of programs.

All of our JavaScript code is sent directly to the public. It should always be of publication quality.

@martin1122
martin1122 / Jest_GitLab_CI.md
Created October 7, 2021 14:41 — forked from rishitells/Jest_GitLab_CI.md
Setting up Jest tests and coverage in GitLab CI

Configuring Jest Tests in GitLab CI

1. Add GitLab CI configuration file in the root

In the root of your project, add .gitlab-ci.yml with the configuration below.

image: node:latest

stages:
@martin1122
martin1122 / vimdiff.md
Created February 1, 2021 10:46
vimdiff cheat sheet

vimdiff cheat sheet

##git mergetool

In the middle file (future merged file), you can navigate between conflicts with ]c and [c.

Choose which version you want to keep with :diffget //2 or :diffget //3 (the //2 and //3 are unique identifiers for the target/master copy and the merge/branch copy file names).

:diffupdate (to remove leftover spacing issues)

:only (once you’re done reviewing all conflicts, this shows only the middle/merged file)

@martin1122
martin1122 / reorderAutoIncrementIDs.sql
Created June 18, 2020 13:03 — forked from carloscarcamo/reorderAutoIncrementIDs.sql
Reorder auto increment IDs on MySQL
SET @count = 0;
UPDATE table_name SET table_name.id = @count:= @count + 1;
ALTER TABLE table_name AUTO_INCREMENT = 1;
@martin1122
martin1122 / readme.txt
Created October 21, 2019 16:58 — forked from khoiron14/readme.txt
How to install ionicons on laravel project
1. npm install ionicons --save
2. add on /resources/assets/sass/app.scss ->
@import "node_modules/ionicons/dist/scss/ionicons";
3. npm run dev
4. summon app.css on your view ->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
5. use, *example ->
<i class="ion-ios-paper-plane-outline"></i>
# doc https://ionicframework.com/docs/ionicons/
@martin1122
martin1122 / eloquent-cheatsheet.php
Created April 19, 2018 15:51 — forked from hassansin/eloquent-cheatsheet.php
Laravel 5 Eloquent CheatSheet #laravel #eloquent
Model::
/*Select*/
select('col1','col2')
->select(array('col1','col2'))
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating'))
->addSelect('col3','col4')
->distinct() // distinct select
/*From*/
@martin1122
martin1122 / .vimrc
Created April 15, 2018 07:17
My Configuration (Thanks to Jeffrey Way - Laracasts)
set nocompatible
source ~/.vim/plugins.vim
syntax enable
set number
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set backspace=indent,eol,start
@martin1122
martin1122 / countryblock.sh
Created February 10, 2018 06:32 — forked from mombrea/countryblock.sh
Block a list of IP ranges using IPSet and IPTables
#!/bin/bash
#Script to process ip ranges to ban using IPSet and IPTables
ipset create countryblock hash:net
while read line; do ipset add countryblock $line; done < blocklist.txt
iptables -I INPUT -m set --match-set countryblock src -j DROP
@martin1122
martin1122 / github_post_recieve.php
Created December 27, 2017 05:33 — forked from cowboy/github_post_recieve.php
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi