Skip to content

Instantly share code, notes, and snippets.

@coryarmbrecht
coryarmbrecht / is_installed.sh
Created April 6, 2019 08:20 — forked from JamieMason/is_installed.sh
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@coryarmbrecht
coryarmbrecht / firebase_detect_data.js
Created September 14, 2016 17:56 — forked from cooljith91112/firebase_detect_data.js
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');
.ceil(_.random(1,5, true),2); //Generate Random numbers between 1 & 5 with precision of 2. ex: 4.56