Skip to content

Instantly share code, notes, and snippets.

@humbletim
humbletim / humbletim-ppng-rtc-datachannel.js
Last active September 9, 2024 01:20
ppng.io webrtc data channels snippet
// quick and dirty ppng.io signaling for p2p webrtc data channel -- 2024.09.08 humbletim
// usage -- one side specifies 'left', the other 'right'; both sides specify the same key
// pc = await QuickieDataChannel('left' /* | 'right' */, 'test')
// pc.send('hi');
async function QuickieDataChannel(side, key) {
const prefix = `https://ppng.io/humbletim-test-${key}`;
const pc = new RTCPeerConnection({iceServers:[{urls:'stun:stun.l.google.com:19302'}]});
const candidates = new Promise((resolve, reject)=>{
pc.onicegatheringstatechange = ()=>pc.iceGatheringState === 'complete' && resolve();
});

background (Scene)

 color

fog (Scene)

 type, color, near, far, density
@humbletim
humbletim / common.js
Last active July 15, 2019 00:59
CustomAPIExample test scripts
// multicontext test script
var script = typeof Script === 'object' ? Script : { type: typeof window === 'object' ? 'browser' : 'unknown' };
var api = typeof KasenAPIExample === 'object' ? KasenAPIExample : {};
var details = {
type: script.type + '',
api: api + '',
now: api.now && api.now() + '',
};
@humbletim
humbletim / basecrm_create_lead.php
Created August 24, 2017 13:58 — forked from iaintshine/basecrm_create_lead.php
Create a new lead using php 5.3 and Base API v2
<?php
function createLead($accessToken, array $lead)
{
$method = 'post';
$absUrl = 'https://api.getbase.com/v2/leads';
$headers = array(
'User-Agent: BaseCRM/PHP Sample',
'Authorization: Bearer ' . $accessToken,
'Accept: application/json',

Keybase proof

I hereby claim:

  • I am humbletim on github.
  • I am htio (https://keybase.io/htio) on keybase.
  • I have a public key ASAavTyTo5Al-oomVMaBaSnjLSLM0lIQ22LyD-sHkC_17go

To claim this, I am signing this object:

@humbletim
humbletim / test-parented-overlay-children.js
Last active June 24, 2017 00:10
Test Entity / Overlay models with parented children
// test Client script to compare Model Overlay vs. Model Entity behavior for attached child Overlays
// humbletim @ 2017.06.23
var overlayProps = {
url: MyAvatar.skeletonModelURL,
position: Vec3.sum(Quat.getForward(MyAvatar.orientation), MyAvatar.position),
scale: 1,
};
var ids = {
overlays: [
(function(){
var teleport;
var portalDestination;
var animationURL;
var position;
function playSound(entityID) {
print("playing teleport sound");
if (teleport.downloaded) {
if(!position) {
@humbletim
humbletim / testEntityResourceLeaks-entity.js
Last active March 15, 2017 00:02
Entity unload resource leaks
(function() {
var TROMBONE_URL = "https://s3.amazonaws.com/hifi-public/tony/audio/sad-trombone.wav";
return {
_resource: SoundCache.prefetch(TROMBONE_URL),
_sound: undefined,
_onStateChanged: function() {
var resource = this._resource;
if (resource.state === Resource.State.FINISHED) {
resource.stateChanged.disconnect(this, '_onStateChanged');
this._sound = SoundCache.getSound(TROMBONE_URL);
@humbletim
humbletim / index.html
Last active April 22, 2023 09:59
glm-js source test page
<!-- for gist purposes this BASE HREF makes everything load relative to the current live web examples -->
<!-- note: save this file in a subfolder off the the project root and remove the BASE HREF to experimental locally -->
<base href='https://humbletim.github.io/glm-js/code/test/index.html' />
<!-- glm-js core scripts -->
<script src="../src/glm.common.js" type="text/javascript"></script>
<script src="../src/glm.buffers.js" type="text/javascript"></script>
<script src="../src/glm.experimental.js" type="text/javascript"></script>
<!-- specific vendor back-end (variations exist for tdl-fast and gl-matrix as well) -->
@humbletim
humbletim / car.js
Created February 7, 2017 03:42 — forked from anonymous/car.js
Node circular dependencies example
var gas = require('./gas');
var speed = 0;
exports.drive = function () {
gas.burn();
};
exports.accelerate = function () {
speed += 10;