Skip to content

Instantly share code, notes, and snippets.

View griffgruff's full-sized avatar
💭
rocking

Anthony Griffiths griffgruff

💭
rocking
View GitHub Profile
function split(str, delim, maxNb)
-- Eliminate bad cases...
if string.find(str, delim) == nil then
return { str }
end
if maxNb == nil or maxNb < 1 then
maxNb = 0 -- No limit
end
local result = {}
local pat = "(.-)" .. delim .. "()"
> doc = {"name" : "smith", "age", 30 , "profession" : "hacker"}
> db.people.insert(doc) <-- insert is a method
WriteResult({"nInserted" : 1})
> db.people.find() <-- all documents in collection
// _id is the document id and it can't be changed primary key
// ObjectId it's a type, time the machine process id and a counter global.
@griffgruff
griffgruff / git-dark.css
Last active November 15, 2017 15:12
css
/**
* All of the CSS variables are copied in from the built ui.css but many are unchanged.
* Variables that categorically shouldn't be overridden are commented out.
*/
:root {
/* these should probably stay the same
--color-new: #28a745;
--color-deleted: #d73a49;
@griffgruff
griffgruff / git.md
Last active April 26, 2022 07:38
Quick Git Guide

Quick Guide

git checkout -b web_testsrake

git commit -am "Message for my commit"

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Git Visual studio

import os
clear = lambda: os.system('cls')
worldList = [(3,3),(3,4),(3,2),(2,2),(4,3),(4,4),(4,5),(5,5)]
friendList = [(-1,-1),(0,-1),(1,-1),(-1,0),(1,0),(-1,1),(0,1),(1,1)]
def printWorld(x, y, cellAlive):
if ( cellAlive ):
function traverse(arr, func) {
_.forEach(arr, function(obj) {
var keys = Object.keys(obj)
_.forEach(keys,function (key) {
if (_.isArray(obj[key])) {
traverse(obj[key], func)
}
func(key, obj);
})
});
import { Component, AfterViewInit, ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent implements AfterViewInit {
name = 'Angular 8 by Example: ElementRef';
@griffgruff
griffgruff / ranger-cheatsheet.md
Last active April 26, 2022 06:57 — forked from heroheman/ranger-cheatsheet.md
Ranger Cheatsheet

Ranger Cheatsheet

So I keep forgetting these

General

Shortcut Description
ranger Start Ranger
Q Quit Ranger
@griffgruff
griffgruff / launch.json
Created July 24, 2023 15:40
ts-node-launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
"args": ["src/index.ts", "--example", "hello"],