Skip to content

Instantly share code, notes, and snippets.

View agilgur5's full-sized avatar

Anton Gilgur agilgur5

View GitHub Profile
@jonjack
jonjack / add-update-refresh-github-access-token-on-mac.md
Last active March 18, 2024 12:31
Adding & Updating GitHub Access Token on Mac

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

@benjick
benjick / persist.js
Created June 15, 2017 11:09
mobx-state-tree persist PoC
/* globals localStorage */
import { onSnapshot, applySnapshot } from 'mobx-state-tree';
import Storage from './storage';
export const persist = (name, store, options, schema = {}) => {
let hydrated = false;
let storage = options.storage;
if (typeof localStorage !== 'undefined' && localStorage === storage) {

tracked npm

@tracked is a decorator for Preact that makes working with state values no different than properties on your component instance.

It's one 300 byte function that creates a getter/setter alias into state/setState() for a given key, with an optional initial value. The "magic" here is simply that it works as a property decorator rather than a function, so it appears to integrate directly into the language.

tracked has no dependencies and works with any component implementation that uses this.state and this.setState().

Installation

@danielearwicker
danielearwicker / example.ts
Last active February 19, 2017 09:31
Remox (Redux in MobX)
import { autorun } from "mobx";
import { createStore, Action, Reducer } from "./remox"
interface Person { firstName: string; lastName: string; }
interface SetFirstName { type: "SET_FIRST_NAME", newFirstName: string; }
interface SetLastName { type: "SET_LAST_NAME", newLastName: string; }
function personReducer(state:Person, action: SetFirstName | SetLastName) {
@ruffsl
ruffsl / Dockerfile
Last active February 28, 2024 23:49
Small ROS Network Example
FROM ros:indigo-ros-base
# install ros tutorials packages
RUN apt-get update && apt-get install -y \
ros-indigo-ros-tutorials \
ros-indigo-common-tutorials \
&& rm -rf /var/lib/apt/lists/
@aripalo
aripalo / watchpack-ignore-node-modules.sh
Last active June 30, 2017 14:08
Using webpack and its polling watch feature (via watchpack) can drain CPU which is due to watchpack polling all the npm deps within node_modules folder. This is a quick hack/fix until proper fix is merged & available in watchpack.
#!/bin/bash
# Should be used until https://github.com/webpack/watchpack/pull/23 is merged and available in npm
# See https://github.com/webpack/watchpack/issues/2#issuecomment-135204573 for more info
# Ensure we have npm
if ! hash npm 2>/dev/null; then
echo 'No NPM installed!'
exit 1
fi
@rajadain
rajadain / ConEmu-MaterialTheme.xml
Last active November 6, 2023 08:57
ConEmu Material Theme
<key name="Colors" modified="2015-12-10 22:46:43" build="151210">
<value name="Count" type="dword" data="00000001"/>
<key name="Palette1" modified="2015-12-10 22:46:43" build="151210">
<value name="Name" type="string" data="Material Theme"/>
<value name="ColorTable00" type="dword" data="004d4335"/>
<value name="ColorTable01" type="dword" data="006b60eb"/>
<value name="ColorTable02" type="dword" data="008de8c3"/>
<value name="ColorTable03" type="dword" data="0095ebf7"/>
<value name="ColorTable04" type="dword" data="00c4cb80"/>
<value name="ColorTable05" type="dword" data="009024ff"/>
@megamaddu
megamaddu / fetch-helpers.js
Last active December 23, 2019 19:44
Fetch API Helpers
import fetch from 'isomorphic-fetch'
const setupRequestOptions = (options = {}, overrideMethod) => {
if (overrideMethod) options.method = overrideMethod
if (!options.headers) options.headers = {}
options.credentials = 'same-origin'
return options
}
const setupJsonRequestOptions = (options, overrideMethod) => {
@gaearon
gaearon / slim-redux.js
Last active March 25, 2024 19:12
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@xinan
xinan / material-theme.itermcolors
Created August 1, 2015 16:18
Material Theme iTerm2 Port
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.25882352941176467</real>
<key>Green Component</key>
<real>0.21176470588235294</real>