Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Being cool and writing code

Sivli Embir Sivli-Embir

😎
Being cool and writing code
View GitHub Profile
@Sivli-Embir
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(() => {
navigation.setOptions({headerLeft});
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)
@Sivli-Embir
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;
View example.js
import {getCurrentWeek} from 'weekSolution';
// Friday: -2
getCurrentWeek(-2)
// Saturday: -1
getCurrentWeek(-2)
// Sunday: 0
getCurrentWeek(0)
@Sivli-Embir
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');
}
options.collection.insert({
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'}}
{{message}}
{{/with}}
</template>
View runner.js
var pushConfiguration = null;
testRunner = function (notification, user) {
if(!pushConfiguration)
{
Push.debug = this.debug || false;
pushConfiguration = Push.Configure({
gcm: {
apiKey: this.gcm,
},