Skip to content

Instantly share code, notes, and snippets.

💭
Focused on react native navigation and animations

Javier Marquez arqex

💭
Focused on react native navigation and animations
Block or report user

Report or block arqex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View animatedGraph.js
/**
* Animated works by building a directed acyclic graph of dependencies
* transparently when you render your Animated components.
*
* new Animated.Value(0)
* .interpolate() .interpolate() new Animated.Value(1)
* opacity translateY scale
* style transform
* View#234 style
* View#123
@arqex
arqex / cleanWebpackPlugin.js
Created Jul 20, 2018
webpack clean plugin
View cleanWebpackPlugin.js
const Clean = require('clean-webpack-plugin')
// ...
{
// ...
plugins: [
new Clean('build/*.*', {/* options */})
]
// ...
}
@arqex
arqex / webpack.config.js
Created Apr 15, 2018
Webpack copy plugin
View webpack.config.js
var Copy = require('copy-webpack-plugin');
// ...
{
// ...
plugins: [
new Copy({
from: 'assets/fonts',
to: 'fonts', // path relative to the build folder
toType: 'dir', // or 'file'
ignore: ['*.json'] // We can skip files
@arqex
arqex / config.js
Created Apr 15, 2018
Config using NODE_ENV
View config.js
const config = {}
if( process.env.NODE_ENV === 'production' ){
config.remoteURL = 'http://myserver.com/resource';
}
else {
config.remoteURL = 'http://localhost/resource';
}
export default config;
View webpack.config.js
var webpack = require("webpack");
// ...
{
// ...
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV)
})
]
// ...
@arqex
arqex / installPassPillServer
Created Feb 26, 2018
Installing Passpill server
View installPassPillServer
git clone https://github.com/passpill-io/passpill-backend.git
cd passpill-backend
npm install
npm start
@arqex
arqex / socketEventHub.js
Last active May 16, 2017
Socket event hub
View socketEventHub.js
// This helper will guide our websocket events to freezer
function toFreezer( socketEvent, freezerEvent ){
socket.on( socketEvent, function(){
var args = [freezerEvent].concat( Array.from(arguments) );
freezer.emit.apply( freezer, args );
});
}
// Now we can redirect socket events easily
toFreezer('messageReceived', 'message:received');
View messageReceivedEvent.js
// In our socket event handlers file
socket.on('messageReceived', message => {
freezer.emit('message:received', message);
});
// In our message reactions file
freezer.on('message:received', message => {
freezer.get().messages.push( message );
})
@arqex
arqex / returningReaction.js
Last active May 16, 2017
Returning reaction
View returningReaction.js
// We can return the promise from our reaction
freezer.on('message:send', text => {
freezer.get().set({status: 'SENDING'});
// Return the promise
return Ajax.post('/messages', {text: text} )
.then( msg => {
freezer.get()
.set({status: 'READY'})
.messages.push(msg)
View messageReaction2.js
freezer.on('message:loadAll', () => {
freezer.get().set({status: 'LOADING'});
Ajax.get('/messages').then( messages => {
freezer.get.set({
status: 'READY',
messages: messages
});
// Some other reactions might be listening to this
You can’t perform that action at this time.