Skip to content

Instantly share code, notes, and snippets.

View alexbrillant's full-sized avatar
🎯
Focusing

Alexandre Brillant alexbrillant

🎯
Focusing
  • Québec, Canada
View GitHub Profile
export function occurenceOfCharacters (string) {
const map = new Map()
for (let i = 0; i < string.length; i++) {
const char = string[i]
if (!map.get(char)) {
map.set(char, 1)
} else {
const currentCount = map.get(char)
map.set(char, currentCount + 1)
}
// Place your settings in this file to overwrite the default settings
{
"stylelint.enable": true,
"window.zoomLevel": 0,
"workbench.colorTheme": "Nord",
"editor.fontSize": 14,
"editor.formatOnSave": true,
"editor.lineNumbers": "relative",
"vim.easymotion": true,
"vim.leader": "<space>",
import React, { Component } from "react"
import Swiper from "react-native-deck-swiper"
import { StyleSheet, View, Text, Image, Button } from "react-native"
export default class Exemple extends Component {
constructor(props) {
super(props)
this.state = {
cards: [1, 2],
swipedAllCards: false,
import {
nearestBranchRequest,
nearestBranchSuccess,
nearestBranchFailure,
INITIAL_STATE
} from '../branchReducer';
describe('branch reducer tests', () => {
it('given latitude and longitude when nearestBranchRequest then should set latitude, longitude and searching to true', () => {
const latitude = 1;
import { ACTION_TYPES } from '../actions/branchActions';
const {
NEAREST_BRANCH_SUCCESS,
NEAREST_BRANCH_REQUEST,
NEAREST_BRANCH_FAILURE
} = ACTION_TYPES;
export const INITIAL_STATE = { searching: false, nearestBranch: null };
export default (state = INITIAL_STATE, action) => {
import update from 'immutability-helper';
import {cloneDeep} from 'lodash';
const selectedChoice = {isChosen: true};
const choices = [selectedChoice, selectedChoice, selectedChoice];
const options = {choices: choices};
const selectedOptions = [options, options];
const OPTION_INDEX = 0;
const CHOICE_INDEX = 1;
import {Dimensions} from 'react-native'
const {width, height} = Dimensions.get('window')
const calculateFontSizeForAScreenSizePercentage = (percentage) => {
return Math.sqrt((width * width) + (height * height)) * (percentage / 100)
}
const baseUnit = calculateFontSizeForAScreenSizePercentage(2.5)
const em = (value) => {
@alexbrillant
alexbrillant / zIndexExemple.js
Last active February 19, 2017 10:15
zindex exemple
import React, {
Component
} from 'react'
import {
AppRegistry,
Easing,
StyleSheet,
Text,
Image,
import React, {
Component
} from 'react'
import {
AppRegistry,
Easing,
StyleSheet,
Text,
Image,
@alexbrillant
alexbrillant / CircleTransitionJest.js
Created February 16, 2017 00:35
Circle transition animation jest test
import 'react-native'
import React from 'react'
import CircleTransition from '../CircleTransition.js'
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer'
const positionTest = (position) => {
const tree = renderer.create(
<CircleTransition