Skip to content

Instantly share code, notes, and snippets.

View Sivli-Embir's full-sized avatar
😎
Being cool and writing code

Sivli Embir Sivli-Embir

😎
Being cool and writing code
View GitHub Profile
@Sivli-Embir
Sivli-Embir / test
Last active September 28, 2021 17:17
/**
* 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
Sivli-Embir / usage.js
Last active March 13, 2020 21:59
RN5 on back hook
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(() => {
navigation.setOptions({headerLeft});
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)
import {getCurrentWeek} from 'weekSolution';
// Friday: -2
getCurrentWeek(-2)
// Saturday: -1
getCurrentWeek(-2)
// Sunday: 0
getCurrentWeek(0)
@Sivli-Embir
Sivli-Embir / App.js
Last active June 23, 2017 16:55
A drop in solution to getting dynamic import React components in Meteor 1.5
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
Sivli-Embir / addRunner.js
Created November 23, 2015 20:23
Herald v2.0 Proposal
//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');
}
options.collection.insert({
message: this.message,
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'
<template name='form'>
<input name='email' value={{email}}>
{{#with validate 'email'}}
{{message}}
{{/with}}
</template>
var pushConfiguration = null;
testRunner = function (notification, user) {
if(!pushConfiguration)
{
Push.debug = this.debug || false;
pushConfiguration = Push.Configure({
gcm: {
apiKey: this.gcm,
},