Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dmurawsky's full-sized avatar

Daniel Murawsky dmurawsky

View GitHub Profile
@dmurawsky
dmurawsky / SassMeister-input.scss
Created March 8, 2015 20:04
Generated by SassMeister.com.
// ----
// Sass (v3.2.19)
// Compass (v0.12.7)
// ----
$space:65px;
$light:#eee;
$medium:#ccc;
$dark:#aaa;
$fontSize: 22px;
<div class="se-progress">
<div class="active">
<span class="glyphicon glyphicon-map-marker"></span>
<span class="text">This is some text</span>
<span class="arrow-bg"></span>
<span class="arrow"></span>
</div>
<div class="active">
<span class="glyphicon glyphicon-map-marker"></span>
<span class="text">This is text</span>
import {createElement} from 'react';
import ReactDOM from 'react-dom';
import firebase from 'firebase';
import objectAssign from 'object-assign';
const config = {
apiKey: "<YOUR_FIREBASE_API_KEY>",
authDomain: "<YOUR_PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<YOUR_PROJECT_ID>.firebaseio.com"
};
@dmurawsky
dmurawsky / app.js
Created July 21, 2017 05:17
A gist for creating Stripe users with Firebase and Google Cloud Functions
import { databse } from 'firebase'
const userRef = database().ref('users/' + uid) // Assumes you have the users uid
userRef.update({ token, lastFour }) // Assumes you've used Stripe.js to get a card token and lastFour
userRef.child('stripeCustomerId').on('value', snap => {
let stripeCustomerId = snap.val()
if (stripeCustomerId) {
userRef.child('charges').push({
amount: 4000, // $40
currency: 'usd',
@dmurawsky
dmurawsky / DotEnv.swift
Created August 15, 2017 03:49
Parse ios.env in Swift 3
public func DotEnv() {
guard let path = Bundle.main.path(forResource: "ios", ofType: "env") else { return }
let url = URL(fileURLWithPath: path)
do {
let data = try Data(contentsOf: url)
let str = String(data: data, encoding: .utf8) ?? "Empty File"
let clean = str.replacingOccurrences(of: "\"", with: "")
print(clean)
let envVars = clean.components(separatedBy:"\n")
@dmurawsky
dmurawsky / sidebar.css
Created August 21, 2017 20:48
Sidebar css
/*!
* Start Bootstrap - Simple Sidebar HTML Template (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
/* Toggle Styles */
#wrapper {
padding-left: 0;
@dmurawsky
dmurawsky / Populate_Index_ES6.js
Created August 25, 2017 02:18
Node.js script to populate an index.js file with all files in a directory and export as an object using ES6 export syntax.
const fs = require('fs');
const Populate_Index_ES6 = () => {
const path = __dirname + '/src/dir';
// Read directory
fs.readdir(path + '/components', (err, items) => {
let output = '';
// Add import statements for each file
for (let i=0; i<items.length; i++) {
let file = items[i].substring(0, items[i].length-3);
const functions = require('firebase-functions')
const admin = require('firebase-admin')
admin.initializeApp(functions.config().firebase)
exports.hourly = functions.https.onRequest((req, res) => {
const expiration = Date.now() + * 60 * 60 / 1000 // At least an hour old in seconds
const ref = admin.database().ref("space")
ref.orderByKey("timestamp").endAt(expiration).once("event", snap => {
const vals = snap.val()
Object.keys(vals).map(key => {

Keybase proof

I hereby claim:

  • I am dmurawsky on github.
  • I am drmurawsky (https://keybase.io/drmurawsky) on keybase.
  • I have a public key ASAIzWQBKKkZq8uP71GLE8qcEB3CemKLCzLnnG6wcwhWzgo

To claim this, I am signing this object:

@dmurawsky
dmurawsky / index.js
Last active November 10, 2017 17:21
Simple react app to auth with auth0 and display token
import React, { Component } from "react";
import ReactDOM from "react-dom";
import auth0 from "auth0-js";
class App extends Component {
constructor(props, cxt) {
super(props, cxt);
this.componentDidMount = this.componentDidMount.bind(this);
this._login = this._login.bind(this);
const auth = new auth0.WebAuth({