Skip to content

Instantly share code, notes, and snippets.

View yajamon's full-sized avatar
🥞
I am alive.

yajamon yajamon

🥞
I am alive.
View GitHub Profile
@yajamon
yajamon / thisInFunctions.js
Created January 20, 2017 10:35
this in basic function and allow function
function Hoge (){
console.log("this at constructor: ", this);
var _this = this;
setTimeout(function(){
console.log('this at basic function', this);
console.log('_this at basic function', _this);
},1);
setTimeout(()=>{
console.log('this at allow function', this);
console.log('_this at allow function', _this);
function hogeAsync(callback){
setTimeout(function(){
callback(10);
}, 10000);
}
var one = null;
new Promise(function(resolve, reject){
hogeAsync(resolve);
}).then(function(value){
fuga () {
echo $0
}
echo "current command: $0"
echo "fuga: $(fuga)"
#!/bin/sh
echo '{"private": true}' > package.json
npm install -D vue vue-router typescript
{
echo 'import * as Vue from "./node_modules/vue/types/index";'
echo 'import * as VueRouter from "./node_modules/vue-router/types/index";'
} > index.ts
$(npm bin)/tsc -t 'ES2015' index.ts
@yajamon
yajamon / pointer_increment.c
Created November 29, 2016 03:10
learnPointer
#include <stdio.h>
int printArray(int *ip, int len);
int main(int argc, char *args[]){
int arr[3] = {0, 1, 2};
int *ip = arr;
printArray(arr, 3);
printf("%d\n", *ip);
*ip++; // [0, 1, 2] -> [1, 1, 2]
@yajamon
yajamon / .vimrc
Created November 24, 2016 01:48
.vimrc
" Information
set number
set showcmd
set list
" http://qiita.com/mfujimori/items/9fd41bcd8d1ce9170301
" Search
set ignorecase
set smartcase
enum ClothesType {
OnePiece
}
interface ClothesInterface {
type:ClothesType;
color:Color;
}
class Clothes extends Item implements ClothesInterface {
}
@yajamon
yajamon / generateProjectTypescript.sh
Last active October 30, 2016 17:38
generate project for typescript
#!/bin/bash
main(){
if ! isRequireCommandsInstalled; then
return 1
fi
subtasksBuild=()
@yajamon
yajamon / makeBackupDirectory.sh
Created October 30, 2016 13:12
make backup directory
#!/bin/bash
src=$1
dest=$2
backup=$3
# backupのパスがファイルなら終了
if [ -f $backup ] ; then
echo "\$backup is file"
exit 1
@yajamon
yajamon / notReturnPromise.ts
Last active December 25, 2015 04:55
コールバックパターン、WithPromise、returnPromise
class Todo {
storeName :string = "todo";
db :IDBDatabase;
id :number = null;
value :string = "";
serialize() :TodoSchema{
// ...
}
static deserialize(data){
// ...