Skip to content

Instantly share code, notes, and snippets.

@fscm
fscm / install_cmake.md
Last active May 1, 2024 12:57
[macOS] Install CMake

[macOS] Install CMake

Instructions on how to install the CMake tool on macOS.

Uninstall

First step should be to unsinstall any previous CMake installation. This step can be skipped if no CMake version was previously installed.

To uninstall any previous CMake installations use the following commands:

@benwells
benwells / reduce-example.js
Created May 12, 2016 13:40
Using Array.reduce to sum a property in an array of objects
var accounts = [
{ name: 'James Brown', msgCount: 123 },
{ name: 'Stevie Wonder', msgCount: 22 },
{ name: 'Sly Stone', msgCount: 16 },
{ name: 'Otis Redding', msgCount: 300 } // Otis has the most messages
];
// get sum of msgCount prop across all objects in array
var msgTotal = accounts.reduce(function(prev, cur) {
return prev + cur.msgCount;
@manniru
manniru / reduce-example.js
Created May 30, 2019 21:57 — forked from benwells/reduce-example.js
Using Array.reduce to sum a property in an array of objects
var accounts = [
{ name: 'James Brown', msgCount: 123 },
{ name: 'Stevie Wonder', msgCount: 22 },
{ name: 'Sly Stone', msgCount: 16 },
{ name: 'Otis Redding', msgCount: 300 } // Otis has the most messages
];
// get sum of msgCount prop across all objects in array
var msgTotal = accounts.reduce(function(prev, cur) {
return prev + cur.msgCount;
var request = require("request");
var options = { method: 'POST',
url: 'http://192.168.0.124:1313/api/items',
headers:
{ 'Postman-Token': 'bb425338-e09d-4a35-874d-06049d2a2014',
'cache-control': 'no-cache',
'Content-Type': 'application/json' },
body: { id: 1, name: 'Item 1', price: 100, categoryId: 1, status: 1 },
json: true };
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>A-Frame Object Model mtl file</title>
<script src="https://aframe.io/releases/0.9.0/aframe.min.js"></script>
@hwindo
hwindo / firebase.js
Last active May 1, 2024 12:56
Checking firebase initialization
// basic checking
// if (firebase.apps.length === 0) {
// firebase.initializeApp({
// // ... firebase config
// })
// }
// node module
// example named file: firebase.js
/**
@manniru
manniru / firebase.js
Last active May 1, 2024 12:56 — forked from hwindo/firebase.js
Checking firebase initialization
// basic checking
// if (firebase.apps.length === 0) {
// firebase.initializeApp({
// // ... firebase config
// })
// }
// node module
// example named file: firebase.js
/**
// Anyone can read or write to the bucket, even non-users of your app.
// Because it is shared with Google App Engine, this will also make
// files uploaded via GAE public.
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}
@gd03champ
gd03champ / folder-alias.json
Last active May 1, 2024 12:56 — forked from dannberg/obsidian-daily-note-template.txt
Dann Berg's Daily Note Template for Obsidian. Uses Dataview & Templater plugins. Should be saved as a Markdown file in Obsidian. Read the full tour: https://dannb.org/blog/2022/obsidian-daily-note-template/
{}
@basham
basham / nodejs-rfid.js
Last active May 1, 2024 12:56
Use NodeJS to read RFID ids through the USB serial stream.
/*
DESCRIPTION
-----------
Use NodeJS to read RFID ids through the USB serial stream. Code derived from this forum:
http://groups.google.com/group/nodejs/browse_thread/thread/e2b071b6a70a6eb1/086ec7fcb5036699
CODE REPOSITORY
---------------
https://gist.github.com/806605