Skip to content

Instantly share code, notes, and snippets.

View dmurawsky's full-sized avatar

Daniel Murawsky dmurawsky

View GitHub Profile
@dmurawsky
dmurawsky / my.code-snippets
Last active June 10, 2018 17:40
VS Code snippets
{
"Print to console": {
"scope": "javascript,typescript",
"prefix": "log",
"body": [
"console.log('$1', $2);"
],
"description": "Log output to console"
},
"prettier": {
@dmurawsky
dmurawsky / handler.js
Last active March 11, 2018 15:24
example lex lambda
exports.availability = (event, context, cb) => {
context.callbackWaitsForEmptyEventLoop = false;
console.log(event, context);
return cb(null, {
dialogAction: {
type: "Close",
fulfillmentState: "Fulfilled",
message: {
contentType: "PlainText",
content: "Response from availability lambda"
@dmurawsky
dmurawsky / center.css
Created February 19, 2018 02:30
How to center with table and cell
.center-table {
height: 100%;
width: 100%;
display: table;
}
.center-cell {
position: relative;
display: table-cell;
vertical-align: middle;
text-align: center;
@dmurawsky
dmurawsky / upgrade_expo.md
Last active February 10, 2018 16:41
Upgrade Expo
  1. Upgrade Expo: npm i -g exp.

  2. Open Expo XDE & start a new project.

  3. Copy the expo, react, & react-native versions from the package.json file into your current project.

  4. Upgrade any other packages that might be stale. Especially things like react-navigation, react-native-elements, or any other Expo-specific packages.

  5. Delete node_modules folder, package-lock.json, and/or yarn.lock.

@dmurawsky
dmurawsky / index.js
Last active May 22, 2024 19:01
How to make a page full height in Next.js
const FullHeightPage = () => (
<div>
Hello World!
<style global jsx>{`
html,
body,
body > div:first-child,
div#__next,
div#__next > div {
height: 100%;
@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({

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:

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 => {
@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);
@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;