Skip to content

Instantly share code, notes, and snippets.

@Almouro
Almouro / useRememberListScroll.ts
Created September 19, 2023 15:37
useRememberListScroll
import {useEffect, useRef} from 'react';
import {FlatList} from 'react-native';
const scrollOffsets: {[key: string]: number} = {};
export const useRememberListScroll = <T>(
listRef: React.RefObject<FlatList<T>>,
rowId: string,
) => {
const currentScrollOffset = useRef<number>(0);
@Almouro
Almouro / test.js
Created March 4, 2022 13:16
Scroll script
#!/usr/bin/env node
const shell = require("shelljs");
const mapValues = require("lodash/mapValues");
const _ = require("lodash");
const DEBUG = false;
const executeCommand = (command) => {
return shell.exec(command, { silent: !DEBUG }).stdout;
@Almouro
Almouro / form.js
Created December 26, 2017 10:35
Form with Hoshi
import React, { Component, PureComponent } from 'react';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { DatePicker, Picker, Form, TextInput } from 'react-native-form-idable';
import { Hoshi } from 'react-native-textinput-effects';
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 40,
},
# Run this on https://www.walkhighlands.co.uk/fortwilliam/glencoe.shtml console for instance to show rating
$('.walktable').find('a').each(function() {
const $link = $(this)
const link = $link.prop('href')
const linkText = $link.text()
$.get(link, (html) => {
const rating = $(html).find('[itemprop=ratingValue]').text()
$(`<span>${rating} - </span>`).insertBefore($link);
})
@Almouro
Almouro / BAM.md
Last active March 26, 2017 14:40
# Open Source at BAM
@Almouro
Almouro / prod.md
Last active March 8, 2017 14:39
MEP Mode opératoire

Bump Android and iOS version name and/or version code in fastlane/.env.prod

iOS

Send a build to iTunes Connect

  • Run deployment script: bundle exec fastlane ios deploy --env=prod
  • Go to iTunes Connect > Tab Activity > Wait for build to be processed. Alternatively, change the value of skip_waiting_for_build_processing to true in your fastlane/Fastfile to be informed when it's done.

Test the app with Testflight

  • Go to iTunes Connect > Tab Testflight > Internal testing, select version to test (answer no to the crypto question if needed)
@Almouro
Almouro / yolo.js
Created October 8, 2016 21:35
Automatically create icon for React Native project
const gm = require('gm').subClass({imageMagick: true});
const fs = require('fs-extra');
const path = require('path');
const PROJECT_ROOT = '/Users/almouro/bam/elsan-materniteam/Materniteam';
const IOS_ASSETS_FOLDER = 'ios/Materniteam/Images.xcassets/AppIcon.appiconset';
const ICON_SOURCE = './icon.png';
const iosSizes = [20, 29, 40, 60];
const iosMultipliers = [2, 3];
@Almouro
Almouro / push.md
Last active October 21, 2016 10:52
Push notif DOJO

Prerequisites

  • Ruby Environment Setup -> RVM or RBENV / bundler with Ruby > 2.2.3

  • Cocoapods -> gem install cocoapods

  • Cocoapods init -> pod init && pod repo update

  • NVM and node 6

  • you have a blank react native project

@Almouro
Almouro / Fastlane with Cordova
Last active July 16, 2019 20:19
Fastlane with Cordova
Fastlane with Cordova
@Almouro
Almouro / index.js
Created January 16, 2016 10:43
SO - Joi Validation
var joi = require('joi');
var schema = joi.object({
Formula: joi.object().keys({
Type: joi.alternatives().required()
.when('Params.ShippingSourceType', { is: 'System', then: joi.string().valid('Export') })
.when('Params.ShippingDestinationType', { is: 'System', then: joi.string().valid('Import') }),
Params: joi.object(), // or additional validation
}),
});