Skip to content

Instantly share code, notes, and snippets.

View polymaxcube's full-sized avatar
🧸
AFK griding

samitygon polymaxcube

🧸
AFK griding
  • 09:58 (UTC -12:00)
View GitHub Profile
@polymaxcube
polymaxcube / MainActivity.kt
Last active January 27, 2021 02:26
handson stou
package com.stou.myapp1
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.Gravity
import android.widget.Button
import android.widget.Toast
import kotlinx.android.synthetic.main.toast_test.*
class MainActivity : AppCompatActivity() {
@polymaxcube
polymaxcube / HorizonLayout.xml
Created January 24, 2021 03:36
stou 3 btn workshop
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical">
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@polymaxcube
polymaxcube / merge_subtitles_with_video.py
Created July 24, 2020 14:06
Python script for merging video files (AVI, MP4, MKV) with subtitles (SRT) using ffmpeg (on Windows it will also handle font configuration)
# Have you ever saw this error while trying to merge/embed subtitles
# into a video file on Windows?
#
# Fontconfig error: Cannot load default config file
# [Parsed_subtitles_0 @ 0000000002bf1ee0] No usable fontconfig configuration # file
# found, using fallback.
# Fontconfig error: Cannot load default config file
#
# This scripts merges subtitles (if present) and transcodes video files
# to H.264 mp4 video files with similar quality level.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@polymaxcube
polymaxcube / main.gs
Last active June 17, 2019 02:39
แก้สคริปดึงข้อมูล Google Sheet เป็น Json File
function doGet(e){
// URL ของ sheet เรา
var ss = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/18P8xV_kaKlI-aU7tvMR9i8ncihw0sm-ZM3XBOfHHMXI/edit#gid=0");
// ใส่ชื่อ sheet
var sheet = ss.getSheetByName("Users");
return getUsers(sheet);
@polymaxcube
polymaxcube / package.json
Created June 16, 2019 13:26
เชื่อม Google Sheet กับ DialogFlow
เพิ่ม
intentMap.set('sheet', scoreHandler);
อย่าลืม callback
function scoreHandler(agent){
let i = "";
const score = request.body.queryResult.parameters.score;
return axios.get('ใส่ api หรือลิงก์ไฟล์ json').then((result) => {
if(!!score){
for(i in result.data){
@polymaxcube
polymaxcube / article_url_friendly_thailang.rb
Last active October 29, 2023 08:05
Ruby on Rails - Pretty URL UTF-8 characters in FriendlyId Gem
class Article < ApplicationRecord
extend FriendlyId
friendly_id :title, use: [:slugged, :history]
has_one_attached :image
has_many_attached :attachments
def normalize_friendly_id(value)
sep = "-"
value.to_s
url_reserved = /[<>#%"\[\]\{\}\|\/\^:;@&=$\+,\\]|\s+/
@polymaxcube
polymaxcube / workshop.java
Last active December 3, 2022 13:07
Workshop 7-10 comsci
//
import java.util.Scanner;
public class samiti {
public static void main(String args[]){
//Choose Logic
int choose = 0;
@polymaxcube
polymaxcube / oddevenfinder.java
Created December 5, 2018 17:08
Find Odd and Event number then sum together and find the different between sum of both
import static java.lang.Math.abs;
public class EvenOddSum {
public static void main(String args[]) {
int odd = 0;
int even = 0;
int i = 0;
while( i<=100){
@polymaxcube
polymaxcube / animationAutoDectector.js
Created July 11, 2018 14:18
Detact Animation JavaScript
// Listener Autofill
const AUTOFILLED = 'is-autofilled';
const onAutoFillStart = (el) => el.classList.add(AUTOFILLED);
const onAutoFillCancel = (el) => el.classList.remove(AUTOFILLED);
document.querySelector('input').addEventListener('animationstart', onAnimationStart, false);
const onAnimationStart = ({ target, animationName }) => {
switch (animationName) {
case 'onAutoFillStart':
return onAutoFillStart(target)