Skip to content

Instantly share code, notes, and snippets.

View bentooth's full-sized avatar

Ben Vera bentooth

  • Texas
View GitHub Profile
-- Enable foreign keys in SQLite
PRAGMA foreign_keys = ON;
-- Users Table
CREATE TABLE IF NOT EXISTS users (
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
bio TEXT,
profile_image_path TEXT, -- Path: "users/{user_id}/profile-pictures/profile.jpg"
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
class ETAudioPlayer {
constructor() {
this.playlist = [];
this.fullMobilePlayerShow = false;
this.fullMobileListShow = false;
this.currentSong = {};
this.previousSongId = -1;
this.playing = false;
this.loading = false;
this.moving = false;
@bentooth
bentooth / user.js
Created June 12, 2019 18:19
redux-pender
import axios from "axios";
import { pender } from "redux-pender";
import { createAction, handleActions } from "redux-actions";
function getDate() {
let utcDate = new Date(Date.now());
return utcDate.toUTCString();
}
const _getUser = (token) => {
@bentooth
bentooth / 22
Created September 3, 2018 20:01
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { withRouter, Route, Switch, Redirect } from 'react-router-dom';
import Main from 'containers/Main'
import Onboarding from 'containers/Onboarding'
import Login from 'containers/Login'
class App extends Component {
render() {
@bentooth
bentooth / old code
Created September 3, 2018 19:50
old
import React, { Component } from 'react';
import { Route, Link, Switch } from 'react-router-dom'
import Navigation from 'components/Navigation';
import FeaturedRelease from 'components/FeaturedRelease';
import ArtistContainer from 'containers/routes/ArtistContainer'
import DiscographyContainer from 'containers/routes/DiscographyContainer'
import ArtistProfileContainer from 'containers/routes/ArtistProfileContainer'
import NewsContainer from 'containers/routes/NewsContainer'
@bentooth
bentooth / index.js
Created April 11, 2018 19:17
./node_modules/ethereumjs-util fix
var createKeccakHash = require('keccak')
var secp256k1 = require('secp256k1')
var assert = require('assert')
var rlp = require('rlp')
var BN = require('bn.js')
var createHash = require('create-hash')
var Buffer = require('safe-buffer').Buffer
Object.assign(exports, require('ethjs-util'))
/**
@bentooth
bentooth / Home.jsx
Created April 7, 2018 22:40
web3 stuff
import React, { Component } from 'react';
import styled from 'styled-components';
//import web3 from 'web3';
const StyledHome = styled.div`
color: blue;
`;
class Home extends Component {
constructor() {
const express = require('express');
const app = express();
const path = require('path');
const httpProxy = require('http-proxy');
const renderer = require('./renderer');
app.get(/^\/([^a]|a[^p]|ap[^i]|api[^/]).*$|^\/$/, renderer);
app.use(express.static(path.join(__dirname, '../build')));
@bentooth
bentooth / apiServer.js
Created October 20, 2017 20:24
mLab example
"use strict"
var express = require('express');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
const session = require('express-session');
const MongoStore = require('connect-mongo')(session);
var app = express();
app.use(bodyParser.json());