Skip to content

Instantly share code, notes, and snippets.

View linglung's full-sized avatar

linglung

  • C+ Java
View GitHub Profile
const MSG_WORKER_RESULT = WM_USER;
procedure WorkerResult(var msg: TMessage); message MSG_WORKER_RESULT;
procedure TfrmTThreadComm.WorkerResult(var msg: TMessage);
begin
ProcessResults;
end;
@linglung
linglung / gist:80a0be7728dc825ff5cccb2814efe47a
Created January 9, 2017 09:38 — forked from fabriciocolombo/gist:4279304
Capturing console output with Delphi
//Anonymous procedure approach by Lars Fosdal
type
TArg<T> = reference to procedure(const Arg: T);
procedure TForm1.CaptureConsoleOutput(const ACommand, AParameters: String; CallBack: TArg<PAnsiChar>);
const
CReadBuffer = 2400;
var
saSecurity: TSecurityAttributes;
hRead: THandle;
<?php
function covtime($yt_time){
$start = new DateTime('@0'); // Unix epoch
$start->add(new DateInterval($yt_time));
return $start->format('H:i:s');
}
echo covtime('PT2H34M25S');
##regex
^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*
@linglung
linglung / getYoutubeId.coffee
Created January 16, 2017 01:57 — forked from Zaggen/getYoutubeId.coffee
Youtube id regex matcher
getYoutubeId = (url)->
regExp = ///
^(?:https?:\/\/)? # Optionally checks if the string starts with http:// or https://
(?:www\.)? # Optionally checks if the string has a www. (after the http, https or starts with it)
youtu\.?be(?:\.com)? # Matches the youtube domain, which could be youtube.com or youtu.be
\/(?:v\/|.*u\/\w\/|embed\/|watch\?v=)? # Matches the url paths that could go before the id, like /embed/ or /watch?v=
([^#\&\?]*) # (CAPTURING-GROUP) Matches any id-like string
# Now if the pattern before did not find anything, we try the one below
|^([0-9,a-zA-Z\-]+)$ # (CAPTURING-GROUP) Matches any id-like string, so passing only the id will return it back
// Run from the dev tools console of any Youtube video
// Accurate as of October 28, 2016. Uses quality + video type for naming now,
// prevents video urls being overwritten.
// ES6 version
const videoUrls = ytplayer.config.args.url_encoded_fmt_stream_map
.split(',')
.map(item => item
.split('&')
.reduce((prev, curr) => (curr = curr.split('='),
unit VirtualListData;
// Author : Russell Libby
// Date : 02.22.2006
// Description : Data store object for running a list view in virtual mode
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
@linglung
linglung / youtube api video category id list
Created February 14, 2017 01:56 — forked from dgp/youtube api video category id list
youtube api video category id list
2 - Autos & Vehicles
1 - Film & Animation
10 - Music
15 - Pets & Animals
17 - Sports
18 - Short Movies
19 - Travel & Events
20 - Gaming
21 - Videoblogging
22 - People & Blogs
/*! wavesurfer.js 1.4.0 (Mon, 10 Apr 2017 08:55:35 GMT)
* https://github.com/katspaugh/wavesurfer.js
* @license BSD-3-Clause */
!function(a,b){"function"==typeof define&&define.amd?define("wavesurfer",[],function(){return a.WaveSurfer=b()}):"object"==typeof exports?module.exports=b():a.WaveSurfer=b()}(this,function(){"use strict";var a={defaultParams:{audioContext:null,audioRate:1,autoCenter:!0,backend:"WebAudio",barHeight:1,closeAudioContext:!1,container:null,cursorColor:"#333",cursorWidth:1,dragSelection:!0,fillParent:!0,forceDecode:!1,height:128,hideScrollbar:!1,interact:!0,loopSelection:!0,mediaContainer:null,mediaControls:!1,mediaType:"audio",minPxPerSec:20,partialRender:!1,pixelRatio:window.devicePixelRatio||screen.deviceXDPI/screen.logicalXDPI,progressColor:"#555",normalize:!1,renderer:"MultiCanvas",scrollParent:!1,skipLength:2,splitChannels:!1,waveColor:"#999"},init:function(b){if(this.params=a.util.extend({},this.defaultParams,b),this.container="string"==typeof b.container?document.querySelector(this
@linglung
linglung / submit.md
Created March 26, 2018 23:59 — forked from tanaikech/submit.md
Binance API for Google Apps Script

Binance API for Google Apps Script

This sample script is for using Binance API by Google Apps Script. This script encryptes "signature" like samples. In this script, "Example 1: As a query string" is used, and it retrieves "All orders (SIGNED)" by "GET".

function main() {
    var key = '#####'; // Please input your key.
    var secret = '#####'; // Please input your secret.
    var api = "/api/v3/allOrders"; // Please input API Endpoint you want.
    var timestamp = Number(new Date().getTime()).toFixed(0);
 var string = "symbol=LTCBTC&amp;timestamp=" + timestamp; // Please input query parameters for the inputterd API.