Skip to content

Instantly share code, notes, and snippets.

View moduscreate's full-sized avatar

Modus Create moduscreate

View GitHub Profile
#!/usr/bin/env node
require('./colorTheme.js');
function stringify(obj) {
return JSON.stringify(obj, undefined, 4);
}
import React from 'react';
import {
StyleSheet,
TextInput,
TouchableOpacity,
Text,
KeyboardAvoidingView,
View,
} from 'react-native';
import { Permissions, Notifications } from 'expo';
sendPushNotification(token = this.state.token, title = this.state.title, body = this.state.body) {
return fetch('https://exp.host/--/api/v2/push/send', {
body: JSON.stringify({
to: token,
title: title,
body: body,
data: { message: `${title} - ${body}` },
}),
headers: {
'Content-Type': 'application/json',
@moduscreate
moduscreate / registerForPushNotifications.js
Created February 16, 2018 18:38
Expo Notifications Demo - registerForPushNotifications
async registerForPushNotifications() {
const { status } = await Permissions.getAsync(Permissions.NOTIFICATIONS);
if (status !== 'granted') {
const { status } = await Permissions.askAsync(Permissions.NOTIFICATIONS);
if (status !== 'granted') {
return;
}
}
#ifndef SONG_H
#define SONG_H
#define Song const uint8_t PROGMEM
Song music[] = {
0x14, // Number of tracks
0x00, 0x00, // Address of track 0
0x27, 0x00, // Address of track 1
0x42, 0x00, // Address of track 2
#ifndef SONG2_H
#define SONG2_H
#include "atm_cmd_constants.h"
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
#endif
#ifndef NUM_PATTERNS
#ifndef SONG_H
#define SONG_H
#define Song const uint8_t PROGMEM
Song music[] = {
0x14, // Number of tracks
0x00, 0x00, // Address of track 0
0x27, 0x00, // Address of track 1
0x42, 0x00, // Address of track 2
@moduscreate
moduscreate / GameBoard.js
Created August 7, 2017 17:18
Full file for React Native Shooter, EVADE (prototype).
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
Dimensions,
PanResponder
} from 'react-native';
// JAVASCRIPT To generate this stuff below: (Paste in JSFIddle.net)
var map = {
'A' : 0,
'B' : 1,
'C' : 2,
'D' : 3,
'E' : 4,
'F' : 5,
'G' : 6,
'H' : 7,
@moduscreate
moduscreate / data_dump.js
Last active October 21, 2016 15:03
GORUCK data dump proposal
{
"timestamp": 1476970157974, // Let's use this to determine changes.
// Sourced from http://www.goruck.com/event-landing
"eventLocations" : {
"eventTypes": [
{
"eventTypeId": 1004,
"eventTypeName": "Ascent",
"eventCategoryId": 2,