Skip to content

Instantly share code, notes, and snippets.

View omt66's full-sized avatar
🙂

Ogun omt66

🙂
View GitHub Profile
@espozbob
espozbob / App.java
Last active December 2, 2020 19:22
AWS - Amazon DynamoDB Transaction Example for Java
package com.vogella.maven.quickstart;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.regions.Regions;
@dweldon
dweldon / install-docker.sh
Last active April 8, 2022 11:18
Install docker CE on Linux Mint 18.3
#!/usr/bin/env bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable"
sudo apt-get update
sudo apt-get install docker-ce
# https://docs.docker.com/compose/install/
const admin = require('./node_modules/firebase-admin');
const serviceAccount = require("./service-key.json");
const data = require("./data.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://YOUR_DB.firebaseio.com"
});
@simenbrekken
simenbrekken / schema.js
Created December 21, 2016 14:06
Firebase backed GraphQL schema
import firebase from 'firebase'
import { filter, map } from 'lodash'
import { makeExecutableSchema } from 'graphql-tools'
firebase.initializeApp({
databaseURL: 'https://grafire-b1b6e.firebaseio.com',
})
const mapSnapshotToEntity = snapshot => ({ id: snapshot.key, ...snapshot.val() })
const mapSnapshotToEntities = snapshot => map(snapshot.val(), (value, id) => ({ id, ...value }))
@MarcoWorms
MarcoWorms / mini-redux.js
Last active August 7, 2023 19:06
Redux in a nutshell
function createStore (reducers) {
var state = reducers()
const store = {
dispatch: (action) => {
state = reducers(state, action)
},
getState: () => {
return state
}
}
@rakawestu
rakawestu / app.js
Created July 21, 2016 06:59
Node JS and MySQL Example With Pug Templating Engine
var express = require('express');
var mysql = require('mysql');
var app = express();
///
/// Create connection to MySQL database server.
///
function getMySQLConnection() {
return mysql.createConnection({
@voronianski
voronianski / simple-react-playground.html
Last active April 6, 2024 16:59
Quick React prototyping in browser on the fly with ES2015. Use this as boilerplate for your playground and upload html file on some server. Created as a solution for this challenge - http://blog.vjeux.com/2015/javascript/challenge-best-javascript-setup-for-quick-prototyping.html with the help of https://github.com/voronianski/babel-transform-in-…
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>React Quick Prototyping</title>
</head>
<body>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.min.js"></script>
@ivanoats
ivanoats / jqh.js
Created December 10, 2015 04:32
Hyperscript for jQuery
// hyperscript for jQuery
// create nested HTML elements with a DSL
// used to create reusable, interactive HTML components
//
// based on the many implentations out there like
// https://github.com/dominictarr/hyperscript
// https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript
// and Elm https://github.com/evancz/elm-html
var $h = function(element, properties, content) {
var $component = $('<' + element + '>');
@scottwrobinson
scottwrobinson / brain-mnist.js
Created December 7, 2015 15:22
Brain.js example for training and testing on MNIST data
var brain = require('brain');
var fs = require('fs');
var getMnistData = function(content) {
var lines = content.toString().split('\n');
var data = [];
for (var i = 0; i < lines.length; i++) {
var input = lines[i].split(',').map(Number);