Skip to content

Instantly share code, notes, and snippets.

Being cool and writing code

Sivli Embir Sivli-Embir

Being cool and writing code
View GitHub Profile
View test
* Assume this is syntactically the same as the fetch API with the application/json header
* This mock fetch call has three outputs:
* If no cursor is given it returns a response with data: ['a', 'b', 'c']
* and a cursor string of VALID_CURSOR.
* If it is given the VALID_CURSOR it returns data: [ 'd', 'e' ].
* If its given an invalid cursor it will return an error property.
Sivli-Embir / usage.js
Last active Mar 13, 2020
RN5 on back hook
View usage.js
import React, {useLayoutEffect} from 'react'
import useRN5Back from './useRN5Back'
export default function Example({navigation}) {
const [headerLeft, onBack] = useRN5Back(navigation, () => { //note any variables here
console.log('I am doing cleanup before onBack!')
useLayoutEffect(() => {
View YEP_EnhancedTP_Diff.diff
diff --git a/YEP_EnhancedTP.js b/SIV_EnhancedTP.js
index 0c5a4bf..58ca159 100644
--- a/YEP_EnhancedTP.js
+++ b/SIV_EnhancedTP.js
@@ -2854,6 +2854,10 @@ Game_BattlerBase.prototype.initTpMode = function() {
this._tpMode = this.enemy().tpMode;
this._unlockedTpModes = this.enemy().unlockedTpModes.slice();
+ if (this.pendingInit.length) {
+ this._unlockedTpModes = this._unlockedTpModes.concat(this.pendingInit)
View example.js
import {getCurrentWeek} from 'weekSolution';
// Friday: -2
// Saturday: -1
// Sunday: 0
Sivli-Embir / App.js
Last active Jun 23, 2017
A drop in solution to getting dynamic import React components in Meteor 1.5
View App.js
import React from 'react';
import AsyncComponent from './AsyncComponent'
// call this.getAsyncComponent(path) to get a default export.
// call this.getAsyncComponent(path, specifier) to get a non-default export.
class App extends AsyncComponent {
render() {
let view;
Sivli-Embir / addRunner.js
Created Nov 23, 2015
Herald v2.0 Proposal
View addRunner.js
//this would be the start of what is now the 'inApp' runner
Herald._runners['mongo'] = function (message, options) {
if (!options.collection || !options.collection.insert) {
throw new Meteor.Error('Herald - mongo runner', 'No Mongo.Collection found, please set it in your defaults');
if (!options.userId) {
throw new Meteor.Error('Herald - mongo runner', 'You must give a user id');
message: this.message,
View keyArraytoValue.js
myLookupObj = {};
//for each might not exits, you may need to use a for loop
[“member1”, “member2”, “member3”].forEach(function () {
myLookupObj[key] = 'location';
//then continue as you have been
myLookupObj[“member2”] //-> 'location'
View idea.html
<template name='form'>
<input name='email' value={{email}}>
{{#with validate 'email'}}
View runner.js
var pushConfiguration = null;
testRunner = function (notification, user) {
Push.debug = this.debug || false;
pushConfiguration = Push.Configure({
gcm: {
apiKey: this.gcm,