Skip to content

Instantly share code, notes, and snippets.

View abeisgoat's full-sized avatar

Abe Haskins abeisgoat

View GitHub Profile
@abeisgoat
abeisgoat / client.js
Last active August 29, 2015 13:57
Anonymous Login in Firebase for NodeJS
// Get the SDK: https://cdn.firebase.com/js/client/1.0.6/firebase.js
// Get awesome JSONP lib: https://rawgithub.com/larryosborn/JSONP/master/dist/jsonp.min.js
firebaseName = "brilliant-fire-67";
ref = new Firebase("https://" + firebaseName + ".firebaseio.com/")
JSONP({
url: 'https://auth.firebase.com/auth/anonymous',
data: {transport: 'jsonp', firebase: firebaseName},
success: function(data) {

Keybase proof

I hereby claim:

  • I am abeisgreat on github.
  • I am abeisgreat (https://keybase.io/abeisgreat) on keybase.
  • I have a public key whose fingerprint is 7B1A 67C3 9417 3F89 9009 8BA3 BDAC 4F61 5AE8 6362

To claim this, I am signing this object:

var spawn = require('child_process').spawn;
module.exports = {
deploy: function (email, password) {
var login = spawn.bind(spawn, 'firebase', ['login', '--email='+email, '--password='+password]),
push = spawn.bind(spawn, 'firebase', ['deploy']);
login().stdout.on('data', function(chunk) {
if (chunk.toString() == "Login Successful\n") {
push().stdout.on('data', function (chunk) {
@abeisgoat
abeisgoat / CannonTest.js
Last active January 2, 2016 19:09
A hacked up idea for Cannon.js
var Cannon = function (url) {
this.url = url;
this.reloaderStrs = {};
this.projectileStr = "*";
this.rawData = [];
this.fetches = 0;
this.delayInt = 0;
var self = this;
@abeisgoat
abeisgoat / annotate.sh
Created February 27, 2016 11:33
Google Vision Shell Script
#!/usr/bin/env bash
####################################################
## Google Vision API Client ##
####################################################
#
# 1. Create "key" file with GCloud credential
# 2. run ./annotate.sh URL
# 3. Get back Vision API tags
#
####################################################
@abeisgoat
abeisgoat / example.html
Last active July 19, 2016 19:18
Firebase Storage + Imgix
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Imgix / Firebase Storage</title>
<script src="https://www.gstatic.com/firebasejs/3.2.0/firebase.js"></script>
<script>
var IMGIX_REDIRECT_URL = "";
var config = {
//...
@abeisgoat
abeisgoat / main.go
Last active August 9, 2016 18:54
Connect to the Firebase Realtime Database in Golang using the Google API *http.Client
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
@abeisgoat
abeisgoat / Caddyfile
Created February 8, 2017 02:34
caddy-ssl-proxy
:443
gzip
log /var/log/access.log
proxy / mafia {
header_upstream Host {host}
}
tls {
max_certs 100000
}
const net = require("net")
const path = require("path")
const pipePath = process.platform == "win32" ? path.join('\\\\?\\pipe', process.cwd(), 'huh') : "./huh.pipe";
(async () => {
await delay(3000);
console.log("C: Attempting to connect")
const client = net.connect(pipePath);
client.on('data', function(data) {
console.log("S->C:", data.toString());
@abeisgoat
abeisgoat / ImageUpload.js
Last active January 30, 2020 15:54
An example of image uploading using Firebase with AngularFire.
angular.module('app')
.controller('ImageUpload', ['$scope', '$log',
function ImageUpload($scope, $log) {
$scope.upload_image = function (image) {
if (!image.valid) return;
var imagesRef, safename, imageUpload;
image.isUploading = true;
imageUpload = {