Skip to content

Instantly share code, notes, and snippets.

View andrekovac's full-sized avatar
🐒

André Kovac andrekovac

🐒
View GitHub Profile
@AllBitsEqual
AllBitsEqual / JavascriptArraysAndUnicorns.js
Last active September 21, 2021 14:12
A short rundown of JavaScript Array methods, visualised using Emoji because people love emoji... [🦄💩]
/*
* some helpers to keep the examples clean
*/
const makeUnicorn = (animal) => animal === '🐴' ? '🦄' : '💩'
const isUnicorn = (animal) => animal === '🦄'
const isNoUnicorn = (animal) => animal !== '🦄'
const countUnicorns = (count, animal) => count + (animal === '🦄' ? 1 : 0)
const copyAnimals = (animals) => [...animals]
const express = require('express');
const app = express();
// Application
app.get('/', function(req, res) {
if (process.env.NODE_ENV === 'development') {
for (var key in require.cache) {
delete require.cache[key];
}
}
@danieldunderfelt
danieldunderfelt / MdxContent.js
Created July 10, 2019 05:49
MDX in React-native
// Use your MDX content with this component.
import React from 'react'
import MDX from '@mdx-js/runtime'
import components from '../utils/markdown/markdown'
// Renders a cimple loading spinner as a test
import Loading from './Loading'
const mdxComponents = {

Creating your own Native Modules

Sometime when we need a specific way to interact with the phone or operator system which is various different between iOS and Android, that when we need to lean that responsibility to the OS it self.

In RN, most of the logic and UI, in the best way, must be consistent between platforms. So, In an advance level of bringing best user experience to end user, we need to create native module, that mean the leaning the logic to the Native Part. There are ton of article out there showing why and when we need to create a native module, I won't dive into explanation again. Instead, I will show you how can we create a native module that could be used in React native code. That mean, you write your Objective-C/Java code, and import and run it as a module in Javascript Code.

I will show you here the most basic way to create the most basic library, called: open https://google.com. It means, I want to open Google by using the default iOS/Android browser in a native way.

Creating re

@nepsilon
nepsilon / how-and-why-to-sign-your-commits-with-gpg.md
Last active June 30, 2017 22:21
How and why to sign your commits with GPG? — First published in fullweb.io issue #105

How and why to sign your commits with GPG?

When a team signs their commits, it’s easy to verify the commits are actually from the team members.

If you don’t have a GPG key yet, generate one with gpg --gen-key. Enter the info at the prompt, and then type gpg --list-secret-keys --keyid-format LONG to view your key info. At the line starting with sec, the string between the / and the space is your PUBLIC_KEY_ID. Note it down, and add run the following command to instruct git to use it:

git config user.signingkey PUBLIC_KEY_ID
git config gpg.program gpg
git config commit.gpgsign true
@frostney
frostney / talk.markdown
Last active September 4, 2017 21:16
ReactiveConf 2017 Lightning talk

This is a lightning talk proposal for ReactiveConf 2017: https://reactiveconf.com/

The Curious Case of Monorepos

Monorepos have often stigmatized as bad practice and as such something that should be avoided. Still, big companies like Facebook, AirBnB and Google are actively using monorepos to manage their projects. In the open source world, monorepos have become more popular with Babel being the most prominent example. We'll dive into why monorepos might have this bad reputation and go into where it makes sense to have monorepos, talk about their advantages and their shortcomings. We'll also look into what tooling solutions are available - especially in a JavaScript context.

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 23, 2024 22:24
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@fokusferit
fokusferit / enzyme_render_diffs.md
Last active April 15, 2024 09:41
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@ca057
ca057 / DebugOutput.js
Last active March 28, 2017 16:38
Simple component which renders all keys and values of an object as debug output, inspired by @Andruschenko
import React, { PropTypes } from 'react';
import {
StyleSheet,
View,
Text,
} from 'react-native';
const styles = StyleSheet.create({
textContainer: {
flexDirection: 'row',
@niieani
niieani / flowtype-vs-typescript.md
Last active November 27, 2018 09:10
Differences between Flowtype and TypeScript