Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View x9t9's full-sized avatar

x9t9 x9t9

  • Hong Kong // Shenzen // Berlin
View GitHub Profile
@x9t9
x9t9 / timer.js
Created May 11, 2019 18:00 — forked from fundon/timer.js
One Page One Timer
var Timer = {
i: 0,
t: 0,
queue: {},
tq: {},
add: function (time, callback) {
if (!this.queue[time]) {
this.queue[time] = [];
this.tq[time] = 0;
}
@x9t9
x9t9 / notepad++.search.k99.txt
Created February 9, 2017 20:26
Notepad ++ wrap URI with link markup <a>
// with search nad replace (regular expression )
// @see http://stackoverflow.com/questions/35222560/how-to-wrap-links-in-a-with-notepad-find-replace-function
// @see also http://stackoverflow.com/questions/13673892/notepad-add-link-html-to-beginning-end-of-every-line-using-regular-expressio
//Find
[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?(\?([-a-zA-Z0-9@:%_\+.~#?&//=]+)|)
//Replace with
<a href="$&">$&</a>
@x9t9
x9t9 / share_links.html
Last active February 9, 2017 12:17
Simple Sharing Links
@x9t9
x9t9 / image2string.jsx
Created February 9, 2017 12:08
Embedding images in scriptUI - Adobe Illustrator
// This function has no Interace ,
// Run from Illusstrator.
// Tested with .png.
// more here : https://forums.adobe.com/thread/2055067
function test(){
var chosenFile = File.openDialog("Choose file");
if(chosenFile != null){
var infile = File(chosenFile.fsName.replace('file://', ''));
var outfile = File (chosenFile.path+"/"+chosenFile.name+".txt");
infile.open ("r");
@x9t9
x9t9 / wp-update.sql
Created February 1, 2017 00:22
Wordpress Update SQL
/**
To update WordPress options with the new blog location, use the following SQL command:
note that this depends also on your folder structure ( wp in own folder here, not root )
**/
UPDATE wp_newsite_options SET option_value = replace(option_value, 'www.oldnetwork.com/multi', 'www.newsite.com/newsite') WHERE option_name = 'home' OR option_name = 'siteurl';
/**
After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:
**/
@x9t9
x9t9 / ui-script.js
Created February 1, 2017 00:21
Adobe CC Scripting UI basics
// This is a script ui for a window ( not panel )
// https://forums.adobe.com/thread/1238745
var box = new Window('dialog', "Some title");
box.panel = box.add('panel', undefined, "Panel title");
box.panel_text1 = box.panel.add('edittext', undefined, "Default_value_1");
box.panel_text2 = box.panel.add('edittext', undefined, "Default_value_2");
box.panel_text3 = box.panel.add('edittext', undefined, "Default_value_3");
box.panel2 = box.add('panel', undefined, "Title (not displayed)");
@x9t9
x9t9 / DateTime.js
Created January 3, 2017 10:02
js Date and Time object examples
// Get current date time
var currentDate = new Date();
// get date
var date = currentDate.getDate();
// get month index (January is 0)
var month = currentDate.getMonth();
// get year