Skip to content

Instantly share code, notes, and snippets.

View Snapshotter.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Screenshotter : MonoBehaviour {
public TextMesh text;
public void Awake() {
float r = 1, g = 1, b = 1;
// Read r, g and b parameters passed into the query as <URL>?r=0.5?g=0?b=0.1
View snapshotter.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Screenshotter : MonoBehaviour {
public TextMesh text;
public void Awake() {
float r = 1, g = 1, b = 1;
// Read r, g and b parameters passed into the query as <URL>?r=0.5?g=0?b=0.1
@tomlarkworthy
tomlarkworthy / index.js
Created Jan 6, 2019
Google Cloud Function
View index.js
const puppeteer = require('puppeteer');
let page;
async function getBrowserPage() {
// Launch headless Chrome. Turn off sandbox so Chrome can run under root.
const browser = await puppeteer.launch({args: [
'--no-sandbox'
]});
return browser.newPage();
}
View firebase.json
{
"hosting": {
"rewrites": [{
"source": "**", "function": "proxy"
}]
}
}
View index.js
const express = require('express');
const proxy = require('http-proxy-middleware')
const request = require('request');
const build = "20181223"
const domain = "us-central1-corepox-staging.cloudfunctions.net"
const wordpress = 'https://corepoxblog.com';
const app = express();
View firebase.json
{
"hosting": {
"redirects": [{
"source": "/corepox",
"destination": "/",
"type": 301
}, {
"source": "/index.php",
"destination": "/",
"type": 301
View glitch.py
from morseapi import MorseRobot
import random
bot = MorseRobot("E8:3C:9F:0E:20:60")
bot.connect()
while True:
bot.eye(random.random() * 256)
bot.turn(45)
bot.say("hi")
@tomlarkworthy
tomlarkworthy / index.js
Created Aug 18, 2019
Google App Engine Flex toggler
View index.js
const moment = require("moment");
const {google} = require('googleapis');
const gae = google.appengine('v1');
const auth = new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/appengine.admin',
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only']
});
View MySceneBehaviour.cs
using UnityEngine;
public class MySceneBehaviour: MonoBehaviour {
private static MySceneParams loadSceneRegister = null;
public MySceneParams sceneParams;
public static void loadMyScene(MySceneParams sceneParams, System.Action<MySceneOutcome> callback) {
MySceneBehaviour.loadSceneRegister = sceneParams;
sceneParams.callback = callback;
UnityEngine.SceneManagement.SceneManager.LoadScene("MyScene");
View world-cities.csv
We can't make this file beautiful and searchable because it's too large.
name,country,subcountry,geonameid
les Escaldes,Andorra,Escaldes-Engordany,3040051
Andorra la Vella,Andorra,Andorra la Vella,3041563
Umm al Qaywayn,United Arab Emirates,Umm al Qaywayn,290594
Ras al-Khaimah,United Arab Emirates,Raʼs al Khaymah,291074
Khawr Fakkān,United Arab Emirates,Ash Shāriqah,291696
Dubai,United Arab Emirates,Dubai,292223
Dibba Al-Fujairah,United Arab Emirates,Al Fujayrah,292231
Dibba Al-Hisn,United Arab Emirates,Al Fujayrah,292239
Sharjah,United Arab Emirates,Ash Shāriqah,292672