Skip to content

Instantly share code, notes, and snippets.

@resting
resting / multiple_ssh_setting.md
Created February 10, 2019 17:05 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@resting
resting / gist:587beae14899e432fbda09e5b8ecb76a
Last active October 11, 2018 08:03
Xcode 10 compilation errors

Check: facebook/react-native#20774

If you get any file not found errors, and you're sure you could compile the project prior to upgrading to Xcode 10, try the following:

  1. Navigate to node_modules/react-native/third-party/glog-0.3.4
  2. ../../scripts/ios-configure-glog.sh
  3. Under Libraries (in workspace), select RCTWebSocket.xcodeproj.
  4. Remove and add back libfishhook.a under Build Phases > Link Binary With Libraries.
@resting
resting / nric-validation.js
Created September 12, 2018 06:01 — forked from eddiemoore/nric-validation.js
Validation for Singapore NRIC and FIN number
//Based on http://www.samliew.com/icval/
function validateNRIC(str) {
if (str.length != 9)
return false;
str = str.toUpperCase();
var i,
icArray = [];
for(i = 0; i < 9; i++) {
@resting
resting / accessing-virtualbox.md
Created August 21, 2018 10:16
Accessing your Virtualbox Guest from your Host OS

Accessing your Virtualbox Guest from your Host OS

As a developer you want to ping and access the webserver on your virtual machine. This is a very simple solution to enable the bridge to the guest VM.

Requirements

  • VirtualBox (latest version)
  • A guest operation system (e.g. Ubuntu)
@resting
resting / upload.js
Last active August 15, 2018 07:54 — forked from ibreathebsb/upload.js
file upload from dataUrl with axios
// Note: only for modern browser
import axios from 'axios'
// helper function: generate a new file from base64 String
const dataURLtoFile = (dataurl, filename) => {
const arr = dataurl.split(',')
const mime = arr[0].match(/:(.*?);/)[1]
const bstr = atob(arr[1])
let n = bstr.length
const u8arr = new Uint8Array(n)
@resting
resting / buildSitemap.js
Created July 11, 2018 00:20 — forked from evantahler/buildSitemap.js
35 lines to build a sitemap for next.js projects
#! /usr/bin/env node
// I am ./bin/buildSitemap.js
const path = require('path')
const glob = require('glob')
const fs = require('fs')
const SITE_ROOT = process.env.SITE_ROOT || 'https://www.actionherojs.com'
const SOURCE = process.env.SOURCE || path.join(__dirname, '..', 'pages', '/**/*.js')
const DESTINATION = process.env.DESTINATION || path.join(__dirname, '..', 'static', 'sitemap.xml')
@resting
resting / colors.less
Last active June 15, 2018 22:16
One dark theme colors
// https://github.com/atom/one-dark-syntax/blob/master/styles/colors.less
// Config -----------------------------------
@syntax-hue: 220;
@syntax-saturation: 13%;
@syntax-brightness: 18%;
// Monochrome -----------------------------------
@mono-1: hsl(@syntax-hue, 14%, 71%); // default text
@resting
resting / nativeJavaScript.js
Created May 28, 2018 16:05 — forked from alexhawkins/nativeJavaScript.js
Implementation of Native JavaScript Methods (forEach, Map, Filter, Reduce, Every, Some)
'use strict';
/*****************NATIVE forEACH*********************/
Array.prototype.myEach = function(callback) {
for (var i = 0; i < this.length; i++)
callback(this[i], i, this);
};
//tests
<?php
///////////////////////////////////////////////////
// STEP 1 - CREATE CLASS THAT WILL BE USED GLOBALY
///////////////////////////////////////////////////
namespace App\MyApp;
class MyApp {
public function sayHello($data = [])
{
echo "Hello World from Facade!";
}
@resting
resting / restrict-decimal-places.directive.ts
Last active December 20, 2017 08:18
Restrict decimal places Angular
// inspired by https://stackoverflow.com/questions/41465542/angular2-input-field-to-accept-only-numbers
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
@Directive({
selector: '[restrictDecimalPlaces]'
})
export class RestrictDecimalPlacesDirective {
constructor(private el: ElementRef) {
}