Skip to content

Instantly share code, notes, and snippets.

View jazmon's full-sized avatar

Atte Huhtakangas jazmon

View GitHub Profile
@jazmon
jazmon / picolors.js
Created October 4, 2023 14:08
Next.js build trace tree formatting
/* eslint-disable no-bitwise */
// ISC License
// Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@jazmon
jazmon / regexes.md
Last active December 1, 2017 14:11
Useful Regexes

Useful regexes

Redux

Add flowtypes to Redux Action Types

export const ([\w_]+) =(?:\n  | )'([\w_\/]+)';
export type $1_TYPE = '$2';\nexport const $1: $1_TYPE = '$2';

Reduce duplicated words from Redux Action types

@jazmon
jazmon / autoexec.cfg
Last active October 9, 2017 17:15
CSGO autoexec
// jaz's CS:GO config
// Updated 2017-10-04
// Rates
rate "786432" // max rate
cl_cmdrate "128"
cl_updaterate "128"
cl_interp "0.0"
cl_interp_ratio "1"
cl_interpolate "1"
@jazmon
jazmon / MyComponent.js
Last active March 20, 2017 17:33
React Native i18n -- MyComponent.js
import React from 'react';
import {
Text,
View,
} from 'react-native';
// Import i18next to get it's translation feature
import i18n from 'i18next';
const MyComponent = () => (
<View>
@jazmon
jazmon / createTranslation.js
Created March 15, 2017 22:04
React Native i18n -- createTranslation.js
/* eslint-env node, es6 */
// This is a quick 'n' dirty script to create the translation.json bundle.
// It crawls the locales folder and each locales subfolder and appends all namespaces to the bundle.
const fs = require('fs');
const path = require('path');
const localesPath = path.resolve(__dirname, '..', 'locales');
const outputPath = path.resolve(__dirname, '..', 'translation.json');
const json = {};
@jazmon
jazmon / common.json
Created March 15, 2017 22:01
React Native i18n -- common.json example
{
"loading": "Loading",
"error": "There was an error",
"welcome": "Welcome to the app!"
}
@jazmon
jazmon / Main.js
Last active March 20, 2017 17:33
React Native i18n - Main.js
import React from 'react';
// Import the i18n bundle
import './i18n';
// Rest of the app setup
import { Provider } from 'react-redux';
import App from './App';
import configureStore from './configureStore';
const store = configureStore();
@jazmon
jazmon / i18n.js
Last active March 15, 2017 21:47
React Native i18n
import i18n from 'i18next';
import i18nextReactNative from 'i18next-react-native-language-detector';
// Path to your translation bundle
import translation from '../translation.json';
i18n
.use(i18nextReactNative) // set to use the React Native locale detector
.init({ // look up these properties in the i18next documentation
fallbackLng: 'en',
debug: false,
@jazmon
jazmon / snippets.cson
Last active August 28, 2016 18:58
My atom snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#