Skip to content

Instantly share code, notes, and snippets.

View tribou's full-sized avatar

Aaron Tribou tribou

View GitHub Profile
@tribou
tribou / nvm_auto_switching.sh
Last active January 9, 2020 02:40
Use PROMPT_COMMAND and nvm to auto-switch versions of node
#!/bin/bash
# Activate a version of Node that is read from a text file via NVM
function use_node_version()
{
local TEXT_FILE_NAME="$1"
local CURRENT_VERSION=$([ -n "$HAS_NVM" ] && nvm current)
local PROJECT_VERSION=$([ -n "$HAS_NVM" ] && nvm version $(cat "$TEXT_FILE_NAME"))
# If the project file version is different than the current version
@tribou
tribou / Home.android.js
Created June 11, 2018 20:50
Android vs iOS image sharing on React Native
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { PureComponent } from 'react'
import {
Button,
Image,
@tribou
tribou / MainApplication.java
Created March 23, 2018 11:38
Example react-native MainApplication class that implements getFileProviderAuthority
package com.example.myapp;
import android.app.Application;
import com.facebook.react.ReactApplication;
import cl.json.RNSharePackage;
import cl.json.ShareApplication;
import com.facebook.react.ReactNativeHost;
@tribou
tribou / init.coffee
Created September 17, 2017 22:02
Customize Atom tab titles to display folder and file name
# Add folder and filename to tab title
atom.workspace.observeTextEditors (editor) ->
if editor.getTitle() isnt "untitled"
sp = editor.getPath().split('/')
title = sp.slice(sp.length-2).join('/')
editor.getTitle = -> title
editor.getLongTitle = -> title
editor.emitter.emit "did-change-title", editor.getTitle()
atom.workspace.onDidOpen (event) ->
#!/bin/bash
PKG=eslint-config-tribou
npm info "$PKG@latest" peerDependencies --json \
| command sed 's/[\{\},]//g ; s/: /@/g' \
| xargs npm install --save-dev "$PKG@latest"

Keybase proof

I hereby claim:

  • I am tribou on github.
  • I am tribou (https://keybase.io/tribou) on keybase.
  • I have a public key ASDsgDVP-VYtVCsr9SXI87f00QOWS-yHwnirWYsvX_kSnwo

To claim this, I am signing this object:

@tribou
tribou / Header.jsx
Last active February 15, 2019 21:48
Example React component that changes classes on scroll and supports passive event listeners where available
import React, { Component } from 'react'
import css from './Header.css'
class Header extends Component {
componentDidMount () {
this._bindScroll()
#!/bin/bash
touch /tmp/Recent.xyz
while true
do
echo "Checking again..."
wget -q https://apt.dockerproject.org/repo/dists/ubuntu-xenial/main/binary-amd64/InRelease -O /tmp/InRelease.xyz
if test /tmp/InRelease.xyz -nt Recent.xyz; then
mplayer /usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg
@tribou
tribou / index.html
Created March 8, 2016 15:59
Sample HTML index page template
<!DOCTYPE html>
<html>
<head>
<meta
charset="utf-8"
></meta>
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1"