Skip to content

Instantly share code, notes, and snippets.

View DevelopKim's full-sized avatar

Develop.Kim DevelopKim

View GitHub Profile
@DevelopKim
DevelopKim / gist:f346633df84c9e2ddb9f565ffa111a85
Last active October 27, 2023 02:48
유튜브 나중에 볼 영상 일괄 삭제
let btns = document.querySelectorAll('#button.style-scope > yt-icon.style-scope.ytd-menu-renderer');
//get three buttons
let itemCount = 1;
//for counting
setInterval(function(){
btns[itemCount].click();
let removeBtn = document.querySelectorAll('#items > ytd-menu-service-item-renderer:nth-child(3) > tp-yt-paper-item')[0]
removeBtn.click();
//remove at list
du -sh *
du -h --max-depth=1
@DevelopKim
DevelopKim / dateformatting
Created August 28, 2013 08:54
javascript date formatting
var today = new Date();
var delimeter = '/';
var formatDate = today.getFullYear() + delimeter +
('0' + (today.getMonth() + 1)).slice(-2) + delimeter +
('0' + today.getDate()).slice(-2);
//ex . Wed Aug 28 2013 17:50:28 GMT+0900 (KST) -> "2013/08/28"
function add_slug_class_to_menu_item($output){
$ps = get_option('permalink_structure');
if(!empty($ps)){
$idstr = preg_match_all('/<li id="menu-item-(\d+)/', $output, $matches);
foreach($matches[1] as $mid){
$id = get_post_meta($mid, '_menu_item_object_id', true);
$slug = basename(get_permalink($id));
$output = preg_replace('/menu-item-'.$mid.'">/', 'menu-item-'.$mid.' menu-item-'.$slug.'">', $output, 1);
}
}
/**
* Load different template for sub category
*/
function sub_category_template() {
// Get the category id from global query variables
$cat = get_query_var('cat');
if(!empty($cat)) {
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
function detect_ie()
{
if (isset($_SERVER['HTTP_USER_AGENT']) &&
(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false))
return true;
else
return false;
}
//to safely serialize
$safe_string_to_store = base64_encode(serialize($multidimensional_array));
//to unserialize...
$array_restored_from_db = unserialize(base64_decode($encoded_serialized_string));
@DevelopKim
DevelopKim / gist:2167475
Created March 23, 2012 06:01
PHP debug logging file and browser
<?
//logging file
function debug_log($message = '<==========DEBUG LOG========>'){
//directory log file
$dir = $_SERVER['DOCUMENT_ROOT'].'/logs';
//save Output Buffer
ob_start();
print_r($message);
$message = ob_get_clean();
if(!file_exists($dir)){
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)