Skip to content

Instantly share code, notes, and snippets.

View nanthanwa's full-sized avatar

Nan Thanwa nanthanwa

  • Chiang Mai, Thailand
View GitHub Profile
@jxson
jxson / README.md
Created February 10, 2012 00:18
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@aodin
aodin / gist:9493190
Last active March 23, 2024 20:24
Parsing JSON in a request body with Go
package main
import (
"encoding/json"
"io/ioutil"
"log"
"net/http"
)
type Message struct {
@sogko
sogko / app.js
Last active November 8, 2022 12:31
gulp + expressjs + nodemon + browser-sync
'use strict';
// simple express server
var express = require('express');
var app = express();
var router = express.Router();
app.use(express.static('public'));
app.get('/', function(req, res) {
res.sendfile('./public/index.html');
@danthareja
danthareja / promises.js
Last active July 25, 2023 03:05
A conjurer's guide to promises
/*
* A quick example of how to use Bluebird and Q to conjure your own promises
*
* Everything going on here is explained further in the following video:
* http://youtu.be/OU7WuVGSuZw?list=PLT-DLWOBKbB4dZ83I_7Ca-sUTvorckG-E
*
*/
// Import node modules
var Q = require('q');
@moneal
moneal / firebase_pre-request_script.js
Created August 23, 2017 02:21
Postman pre-request script to create a Firebase authentication JWT header.
/**
* This script expects the global variables 'refresh_token' and 'firebase_api_key' to be set. 'firebase_api_key' can be found
* in the Firebase console under project settings then 'Web API Key'.
* 'refresh_token' as to be gathered from watching the network requests to https://securetoken.googleapis.com/v1/token from
* your Firebase app, look for the formdata values
*
* If all the data is found it makes a request to get a new token and sets a 'auth_jwt' environment variable and updates the
* global 'refresh_token'.
*
* Requests that need authentication should have a header with a key of 'Authentication' and value of '{{auth_jwt}}'
@Warchant
Warchant / sonarqube-docker-compose.yml
Last active May 28, 2024 20:24
docker-compose file to setup production-ready sonarqube
version: "3"
services:
sonarqube:
image: sonarqube
expose:
- 9000
ports:
- "127.0.0.1:9000:9000"
networks:
@HJianBo
HJianBo / LC_CTYPE.txt
Created November 7, 2017 02:02 — forked from jampajeen/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
// First, go to https://shopee.co.th/user/purchase, and open DevTools.
// Step 1 - Run this code to scroll all the way to the bottom.
const timer = setInterval(() => scrollTo(0, 10000000), 800)
setTimeout(() => {
// Step 2 - Stop scrolling after 1 minute.
clearInterval(timer)
// Step 3 - Sum the total purchase price!
@yoyoismee
yoyoismee / quixoticMultiMint.sol
Created June 11, 2022 15:28
quixotic multi mint
// SPDX-License-Identifier: MIT
// author: yoyoismee.eth
pragma solidity 0.8.14;
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
// @notice - free mint that allow contract to mint might not be the best idea ?
// @dev maybe you should add something like requrie(msg.sender == tx.origin) ?
// yeah not sure if this intended. but you know that 5 is not the limit right? I cound just mint up to the gas limit.
// I'll reach out to the creator to see if she want it back. but yeah maybe be more careful next time quixotic team.