Skip to content

Instantly share code, notes, and snippets.

View yarcowang's full-sized avatar
🌴
On vacation

Yarco yarcowang

🌴
On vacation
View GitHub Profile
@yarcowang
yarcowang / docker-log.sh
Last active January 6, 2023 21:16
simple bash script to show log for a docker image
#!/usr/bin/env bash
DOCKER=`which docker`
usage()
{
echo "Usage: $(basename $0) [-l num] IMAGE"
exit 0
}
@yarcowang
yarcowang / config.php
Last active May 28, 2020 10:20 — forked from jarektkaczyk/config.php
Laravel - tinker like a boss (with PsySH)
<?php // ~/.config/psysh/config.php
// Anything not Laravel - let's try to autoload something likely to exist
if (!defined('LARAVEL_START')) {
return [
'defaultIncludes' => [
getcwd().'/vendor/autoload.php',
getcwd().'/bootstrap/autoload.php',
],
];
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
char name[10];
} Person;
int main() {
// initialize to empty
@yarcowang
yarcowang / tom.md
Last active July 21, 2016 21:03
TOML -> TOM: from TOML to TOM

TOM

This is a modification version of original TOML by Tom Preston-Werner cause i thought:

  • it should be more simple
  • it can be not called as a language (as a developer, i'm lost in a lot of programming languages, tired anyway...)

Objectives

@yarcowang
yarcowang / CRDJ.md
Last active December 13, 2015 05:27
Common Reference Doc in Json format

Common Reference Doc in Json format

Notice:

  • Pages here are all in json format, not normal html page.
  • items appears in path are all in lowercase, ex. :modulename
  • only fields in bold are the required fields

Doc Site in JSON

Common

The docsite should add Access-Control-Allow-Origin to allow cross json requsest.

@yarcowang
yarcowang / gist:4173695
Last active October 13, 2015 09:17
Common Project Initialize Procedure

Common Project Initialize Procedure

This common style is for me in developer eye. You could also follow it by yourself.

Name a project

The very beginning thing is you need to name a project. It is really very important when starting a project. No name, then no project.

  • name should be in english, and should less than 20 characters
@yarcowang
yarcowang / gist:4160360
Last active October 13, 2015 07:27
Common Comment Style

Common Comment Style

Cause i didn't find a useful one, i try to define it for personal using. So some rules are strict.

These ideas come from javadoc and doxygen.

Common rule

  • markdown for the format of internal comment
  • do not comment everywhere, you are doing coding not commenting
@yarcowang
yarcowang / rgb2gray.js
Created November 27, 2012 15:47
RGB转灰度
/**
原始 = rgba(255,0,0,.5) + rgba(0,255,0,.5): <br />
<canvas id="item0" width="120" height="120">
您的浏览器不支持html5
</canvas>
<br />
灰度:<br />
<canvas id="item1" width="360" height="120">
您的浏览器不支持html5
</canvas>
@yarcowang
yarcowang / gist:8969090
Last active August 29, 2015 13:56
what about adding a internal template engine into html5?

There are two techs when thinking about html5 template system.

  • template system ---- deal with UI/view
  • data binding ---- deal with model

template system

template can be local and global.

  • local template parse and load on fly