Skip to content

Instantly share code, notes, and snippets.

View pureexe's full-sized avatar
💻
No

Pakkapon Phongthawee pureexe

💻
No
View GitHub Profile
console.log("%c TEST TEST 55+!", "font: 2em roboto; color: yellow; background-color: green;");
@pureexe
pureexe / app.js
Last active July 19, 2017 07:15
ส่ง irc เข้านายท่าน
//Constant
const irc = require('irc'),
request = require('request'),
express = require('express'),
bodyParser = require('body-parser'),
env = process.env;
const VERIFY_TOKEN = 'โทเคนสำหรับ verify hook ของ facebook';
const ACCEPTED_UID = 'ไอดีของ user เฟสบุ๊คเรา ที่ใช้ส่งข้อความ';
const PAGE_TOKEN = 'โทเคนของเพจ (Life Time token)';
const ircConfig = {
@pureexe
pureexe / _config.yaml
Created July 19, 2017 04:04
scsu fundametal 2017 append _config for support collection
collections:
score:
output: true
defaults:
-
scope:
type: "score"
values:
layout: "score"
@pureexe
pureexe / login.js
Created July 19, 2017 04:00
scsu fundamental 2017 login by md5
$(function() {
$('#searchForm').submit(function(e){
e.preventDefault();
var uid = $('#uid').val().trim();
var email = $('#email').val().trim();
email = email.toLowerCase();
window.location.assign('score/'+md5(uid+'|'+email));
});
});
@pureexe
pureexe / score_template.html
Created July 19, 2017 03:57
score template for scsu fundamental camp 2017
---
layout: default
---
<div class="container" style="margin-top:20px;">
<div>
ชื่อ: {{page.name}}
</div>
<div>
รหัสนักศึกษา: {{page.uid}}
</div>
@pureexe
pureexe / build_score_to_md.js
Created July 19, 2017 03:53
Build score csv to md for SCSU Fundamental camp 2017
const FILENAME = ["group01.csv","group02.csv","group03.csv"];
const fs = require("fs");
const csv = require("fast-csv");
const md5 = require('md5');
const YAML = require('yamljs');
var writeCollection = function(path,data,callback){
var output = "---\n"+ YAML.stringify(data) + "---";
fs.writeFile(path,output,function(err){
if(!err){
@pureexe
pureexe / .htaccess
Created July 17, 2017 13:36
htaccess หน้า error สวยงามขึ้น
#อย่าลืมสร้าง error.html ด้วย
ErrorDocument 500 /error.html
ErrorDocument 503 /error.html
ErrorDocument 508 /error.html
@pureexe
pureexe / .htaccess
Created July 17, 2017 13:36
htaccess หน้า error สวยงามขึ้น
#อย่าลืมสร้าง error.html ด้วย
ErrorDocument 500 /error.html
ErrorDocument 503 /error.html
ErrorDocument 508 /error.html
var path = window.location.pathname;
path = decodeURIComponent(path).substring(1).replace(/\//g, "|");
if(path.trim().length != 0){
var config = {
apiKey: "",
databaseURL: "",
};
firebase.initializeApp(config);
firebase.database().ref("path/"+path).once("value").then(function(snapshot) {
var route = snapshot.val();
@pureexe
pureexe / redirect.html
Created June 16, 2017 09:41
redirect html for alie.firebaseio.com
<script src="https://www.gstatic.com/firebasejs/4.0.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.0.0/firebase-database.js"></script>
<script src="router.js"></script>