Skip to content

Instantly share code, notes, and snippets.

View topherPedersen's full-sized avatar
💭
Rolling my katamari ball

Christopher Pedersen topherPedersen

💭
Rolling my katamari ball
View GitHub Profile
@topherPedersen
topherPedersen / DudeWheresMyScreen.ts
Last active July 25, 2024 22:38
Dude Where's My Screen: How to Know What Screen You Are On in a React Native Navigation App
Navigation.events().registerComponentDidAppearListener(async ({ componentName, componentType }) => {
if (componentType === 'Component') {
alert(`screen: ${componentName}`);
}
});
@jaxatax
jaxatax / randomWord.js
Created October 2, 2019 00:02
Random word generation in JS.
Array.prototype.randomElement = function () {
return this[Math.floor(Math.random() * this.length)];
}
var consonant = [
"th",
"th",
"n",
"mb",
"r",
@joeflack4
joeflack4 / App.jsx
Last active November 8, 2019 08:43
Cannot read property 'isAvailable' of undefined
import auth0 from 'auth0-js';
import Auth0Cordova from '@auth0/cordova';
import React, { Component } from 'react';
import {Tabbar, Tab} from 'react-onsenui';
import DataEntryPage from './pages/DataEntryPage';
import HomePage from './pages/HomePage';
import PersonalPage from './pages/PersonalPage';
export default class App extends Component {
@PlainSight
PlainSight / game.py
Last active December 16, 2023 13:40
Simple Multiplayer Python Game and Server
import pygame, sys
from pygame.locals import *
import pickle
import select
import socket
WIDTH = 400
HEIGHT = 400
BUFFERSIZE = 2048
@phatblat
phatblat / AppDelegate.swift
Last active October 10, 2024 18:40
Example of creating HKObserverQuery and enabling background delivery for multiple HKObjectType
@UIApplicationMain
final class AppDelegate: UIResponder, UIApplicationDelegate {
let healthKitManager = HealthKitManager()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if onboardingComplete {
healthKitManager.requestAccessWithCompletion() { success, error in
if success { print("HealthKit access granted") }
else { print("Error requesting access to HealthKit: \(error)") }
}
@rafaelstz
rafaelstz / get.js
Last active October 6, 2023 14:35
AJAX GET and POST with pure Javascript
// Exemplo de requisição GET
var ajax = new XMLHttpRequest();
// Seta tipo de requisição e URL com os parâmetros
ajax.open("GET", "minha-url-api.com/?name=Henry&lastname=Ford", true);
// Envia a requisição
ajax.send();
// Cria um evento para receber o retorno.