Skip to content

Instantly share code, notes, and snippets.

View nara-l's full-sized avatar

Lawrence Nara nara-l

View GitHub Profile
@nara-l
nara-l / Markdown reference - dillinger.io
Created September 23, 2019 14:45
Markdown - dillinger.io
dillinger.io
@nara-l
nara-l / GQL
Last active October 23, 2019 16:59
GraphQL - Part1 notes
// WHat is it? GraphQL
It's a consistent way for your frontend to request data from your backend. It's beatufiul because the frontend sends a query
which is in the same format as what the backend would return. Less ambiguity
e.g requesting sandwitch from backend , a gql query may be:
sandwidth {
bread
ham
cheese
}
@nara-l
nara-l / Design Patterns
Last active November 11, 2019 20:59
Javascript Design Patterns
I have a keen interest in design patterns as I try to reshape my interst to writing code for day to day and rather, doing
architecture, code reviews, business meetings, etc. This means I must understand design patterns as this would also help me
to understand how to read code.
Of My head the following patterns are what I know:
1. Singleton
2. Factory
3. Facade
4. Flux architecture pattern - Redux, Vuex, NGRx. Breakfast club.
@nara-l
nara-l / Design Patterns
Created November 5, 2019 17:39
Javascript Design Patterns
I have a keen interest in design patterns as I try to reshape my interst to writing code for day to day and rather, doing
architecture, code reviews, business meetings, etc. This means I must understand design patterns as this would also help me
to understand how to read code.
Of My head the following patterns are what I know:
1. Singleton
2. Factory
3. Facade
4.
@nara-l
nara-l / MimeTypeValidator
Created November 7, 2019 23:55
Asynchronous mime-type Validator
import { AbstractControl } from '@angular/forms';
import {Observable, Observer, of} from 'rxjs';
export const mimeType = (
control: AbstractControl
): Promise<{ [key: string]: any }> | Observable<{ [key: string]: any }> => {
if (typeof(control.value) === 'string') {
return of(null);
}
const file = control.value as File;
@nara-l
nara-l / Compare files across branches
Last active November 30, 2021 15:38
Git commands
1. Multiple branches:
https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory
2.https://stackoverflow.com/questions/42112526/how-to-compare-different-branches-in-visual-studio-code
@nara-l
nara-l / largestRemainderRound.js
Created May 22, 2020 14:51 — forked from scwood/largestRemainderRound.js
Largest remainder round
/**
* largestRemainderRound will round each number in an array to the nearest
* integer but make sure that the the sum of all the numbers still equals
* desiredTotal. Uses Largest Remainder Method. Returns numbers in order they
* came.
*
* @param {number[]} numbers - numbers to round
* @param {number} desiredTotal - total that sum of the return list must equal
* @return {number[]} the list of rounded numbers
* @example
@nara-l
nara-l / example.html
Created August 25, 2020 17:42 — forked from 981746/example.html
A simple AngularJS service for handling the 'onbeforeunload' event
<!DOCTYPE html>
<html data-ng-app="TestApp">
<head>
<script src="http://code.angularjs.org/1.2.9/angular.js"></script>
<script>
angular.module('TestApp', [])
.factory('beforeUnload', function ($rootScope, $window) {
// Events are broadcast outside the Scope Lifecycle
@nara-l
nara-l / gist:101ef2167389e6fbb0b1a0b5861ad8b2
Created September 11, 2020 15:30 — forked from leftclickben/gist:322b7a3042cbe97ed2af
Steps to migrate from SVN to GitLab

Steps to migrate from SVN to GitLab

This process worked for me. I take no responsibility for any damage or loss incurred as a result of following or not following these steps or, for that matter, anything else you might do or not do.

Setup

  • SVN is hosted at svn.domain.com.au.
  • SVN is accessible via http (other protocols should work).
  • GitLab is hosted at git.domain.com.au and:
@nara-l
nara-l / Item randomizer and remover
Created September 17, 2020 16:31 — forked from swaters86/Item randomizer and remover
Randomize List Using jQuery and remove all items after the 4th item in the list.
<!doctype html>
<html>
<head>
<title>Randomize List Using jQuery</title>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<style type="text/css">
.list {
width:600px;
margin:0 auto;