Skip to content

Instantly share code, notes, and snippets.

View completejavascript's full-sized avatar

Lam Pham completejavascript

View GitHub Profile
@completejavascript
completejavascript / youtubeID.js
Created March 1, 2022 15:38 — forked from takien/youtubeID.js
Get YouTube ID from various YouTube URL using JavaScript
/**
* Get YouTube ID from various YouTube URL
* @author: takien
* @url: http://takien.com
* For PHP YouTube parser, go here http://takien.com/864
*/
function YouTubeGetID(url){
var ID = '';
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------
# Linux: On npm install: Unhandled rejection Error: EACCES: permission denied
$ sudo chown -R $USER:$GROUP ~/.npm
$ sudo chown -R $USER:$GROUP ~/.config
# Windows: fix UNABLE_TO_GET_ISSUER_CERT_LOCALLY
$ SET NODE_TLS_REJECT_UNAUTHORIZED=0
# Kill any process on port 8066
$ kill $(lsof -t -i:8066)
@completejavascript
completejavascript / ffmpeg-snippets.md
Created March 31, 2019 09:25 — forked from martinruenz/ffmpeg-snippets.md
ffmpeg snippets / cheatsheet
@completejavascript
completejavascript / Device.java
Created March 29, 2019 04:27 — forked from flawyte/Device.java
How to get an Android device's serial number, visible to the user in "Settings > About phone/tablet/device > Status > Serial number".
import android.os.Build;
import java.lang.reflect.Method;
public class Device {
/**
* @return The device's serial number, visible to the user in {@code Settings > About phone/tablet/device > Status
* > Serial number}, or {@code null} if the serial number couldn't be found
*/
public static String getSerialNumber() {
# Get device ID to connect:
$ adb devices
# Get android version
$ adb shell getprop ro.build.version.release
1. Android <= 4.x:
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
const f1 = a => a;
const f2 = (a, b) => a + b;
const f3 = (a, b, c) => a + b + c;
const func = (type, ...params) => {
let r = null;
switch(type) {
case 1: r = f1(...params); break;
case 2: r = f2(...params); break;
const f1 = a => a;
const f2 = (a, b) => a + b;
const f3 = (a, b, c) => a + b + c;
const func = (type, ...params) => {
/* Hoàn thành hàm này */
}
func(1, 1); // -> 1 (1)
func(2, 1, 2); // -> 3 (1 + 2)