Skip to content

Instantly share code, notes, and snippets.

View mm-git's full-sized avatar
🏠
Working

Motoyasu Meguro mm-git

🏠
Working
View GitHub Profile
@ChaDonSom
ChaDonSom / LocalStorage.js
Created March 29, 2020 20:41
Use localstorage as a Vue Composition Api ref
import { ref, watch } from '@vue/composition-api'
export default key => {
let init = localStorage.getItem(key)
const variable = ref(init ? JSON.parse(init) : undefined)
watch(
() => variable.value,
to => {
@Lait-au-Cafe
Lait-au-Cafe / memo.md
Last active August 27, 2020 18:53
GolangでWindows用にクロスコンパイルするときのメモ
$ sudo apt install gcc-multilib
$ sudo apt install gcc-mingw-w64

$ GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc go build -o hoge.exe hoge.go

$ GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go build -o hoge.exe hoge.go

amd64のほうは未検証

@illepic
illepic / private-github-release-download.sh
Last active July 3, 2024 14:18
Download the latest release binary from a private GitHub repo. (i.e. a .tar.gz that you have manually uploaded in a GitHub release). Update OAUTH_TOKEN, OWNER, REPO, FILE_NAME with your custom values.
#!/usr/bin/env bash
# Authorize to GitHub to get the latest release tar.gz
# Requires: oauth token, https://help.github.com/articles/creating-an-access-token-for-command-line-use/
# Requires: jq package to parse json
# Your oauth token goes here, see link above
OAUTH_TOKEN="34k234lk234lk2j3lk4j2l3k4j2kj3lk"
# Repo owner (user id)
OWNER="your-user-name"
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio

@somy-jp
somy-jp / saveShiftJisCSV.js
Last active April 27, 2020 10:42
CSV文字列をUnicodeからShift-JISへ変換してローカルへ保存する
// ecl_array.js(26.256KB)
// https://github.com/wealandwoe/ecl_array.js
// encoding.js(221.71KB)
// https://github.com/polygonplanet/encoding.js
//
// 上記のどちらかを使う
// 比較記事:http://qiita.com/weal/items/3b3ddfb8157047119554
//
// saveAs関数 は FileSaver.js
// https://github.com/eligrey/FileSaver.js/
@skitazaki
skitazaki / postgis-on-centos.rst
Last active September 9, 2016 02:56
CentOS に PostGIS/GDAL/Proj をインストールする手順。

PostGIS on CentOS

CentOS に PostGIS/GDAL/Proj をインストールする。

環境:

  • CentOS 6.4 (64bit)
  • PostgreSQL 9.3
  • PostGIS 2.1
#!/bin/bash
set -e
if ! which gcc; then
echo "Please install OSX command line development tools"
exit 1
fi
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
@hnakamur
hnakamur / hmacsha1_test.go
Created April 23, 2013 14:51
GoでHMAC SHA1を計算するサンプル
package sample
import (
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"io"
"testing"
)
@bshamric
bshamric / cache.js
Last active January 24, 2021 12:08
I like phantomjs, but it doesn't directly support getting images from webpages without requesting them separately like in casperjs. I went through QTNetworking code in the phantomjs repo until I figured out where the cache was. To use this, have all three files in the same directory. Then modify test.js for whatever you need. Call phantom js wit…
var fs = require('fs');
//this is the path that QTNetwork classes uses for caching files for it's http client
//the path should be the one that has 16 folders labeled 0,1,2,3,...,F
exports.cachePath = '/path/to/phantomjs/cache/data/folder';
//this is the extension used for files in the cache path
exports.cacheExtension = "d";
//the resources that are to be saved
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"