Skip to content

Instantly share code, notes, and snippets.

View LarryBattle's full-sized avatar

Larry Battle LarryBattle

View GitHub Profile
@LarryBattle
LarryBattle / for-loop-types-in-es6.js
Created August 21, 2018 06:12
Showing the different types of for loops
(()=>{
const myFriends = [
{ name: "Bob", age: 20},
{ name: "Jane", age: 18},
{ name: "Mary", age: 16},
];
const checkAges = (friends, ages) => {
ages.forEach((age, i) => {
const friendsAge = friends[i].age;
@LarryBattle
LarryBattle / graph-es6.js
Last active March 10, 2016 16:52 — forked from kevinfjbecker/bfs.html
Breadth-first Graph Traversal in ES6
"use strict";
const G = {
vertices: [{
edges: [1, 4]
}, {
edges: [0, 2, 3, 4]
}, {
edges: [1, 3]
}, {
edges: [1, 2, 4]
1. List employees (names) who have a bigger salary than their boss
SELECT
e.`name`
FROM
employees AS e
INNER JOIN employees AS b ON e.bossid = b.employeeid
WHERE
e.salary > b.salary
@LarryBattle
LarryBattle / VersionNumber.go
Created April 12, 2013 16:22
Golang: Find the version of Go during runtime.
package main
import "fmt"
import "runtime"
func main() {
fmt.Printf("Google Go version : %s", runtime.Version() )
}
@LarryBattle
LarryBattle / Join ArrayList in java
Created March 21, 2013 22:31
Join ArrayList in java. Combines all the elements into a string separated the `delimiter`.
/**
* Combines all the elements into a string seperated the `delimiter`.
* Same as `Array.prototype.join()` in Javascript.
* @example
ArrayList<String> x = new ArrayList<String>();
x.add("1");
x.add("2");
joinArrayListString(x, ",").equals("1,2") == true;
@LarryBattle
LarryBattle / autocomplete_MMDDYYYY.html
Created March 4, 2013 08:19
autocomplete MMDDYYYY.<br/> This function helps to autocomplete the date format MMDDYYY<br/> - Converts M to 0M and MMD to MM0D. Ex. `1/` to `01/`, `01/1/` to `01/01/`<br/> - Adds slash for MM and MMDD Ex. `01` to `01/`, `01/02` to `01/02/`<br/> - Converts YY to YYYY. Ex. `01/01/01` to `01/01/2001<br/>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet"
href="http://code.jquery.com/qunit/git/qunit.css" type="text/css"
media="screen" />
</head>
<body>
<p>
<input type="text" class="date"/>