Skip to content

Instantly share code, notes, and snippets.

@TLMcode
TLMcode / GetHTMLFragment.ahk
Last active March 4, 2017 14:48
GetHTMLFragment() returns markup from the clipboard
F1::
Fragment := GetHTMLFragment().getElementsByTagName( "html" )[ 0 ].OuterHTML
msgbox % SubStr( Fragment, 1, 200 ) "`n....`n" SubStr( Fragment, -200 )
ExitApp
CheckClipboard()
{
@TLMcode
TLMcode / AdditionalClientFunctionality.js
Last active February 16, 2017 23:02
materialKit methods plus LaunchModalNewsLetterForm() method
$( '#pol-newsletter-form > a' ).on( 'click', function()
{
var error = false, $nl_email = $( '#pol-newsletter-input' );
if ( $nl_email.prop( 'name' ) !== "nlemail" || $nl_email.val().match( /^[\w-\._\+%]+@(?:[\w-]+\.)+[\w]{2,6}$/i ) === null )
{
$nl_email.tooltip( 'show' );
$nl_email.on( 'click', function()
{
@TLMcode
TLMcode / RndGen.php
Last active February 16, 2017 11:31
PHP RndGen()
function RndGen( $GenLen = 200 )
{
$ChrStr = ''; $nStr = ''; $MaxSet = 122;
// gen chr string
For ( $i = 0; $i <= $MaxSet; $i++ )
$ChrStr .= ( ( $i > 32 && $i != 60 ) ? ltrim ( chr( 32 ) . chr( $i ) ) : "" );
// shuffle chr string
While ( strlen( $nStr ) < $GenLen )
@TLMcode
TLMcode / Lenovo_Trackpad_Configuration.ahk
Created February 4, 2017 17:15
Lenovo Trackpad Configuration
tpConf := A_ProgramFiles "\Elantech\ETDAniConf.exe"
CnfStatObj := { "Tap" : 1 , "Drag" : 12, "EGS_V" : 16 , "EGS_H" : 17
, "Zoom" : 28, "SC_V" : 29, "SC_H" : 30, "Rotation" : 32
, "PageUpDown" : 42, "ThreeFingerMoveUp" : 43, "SM" : 48 }
if !WinExist( "ahk_exe " tpConf )
{
Run % tpConf,,, tpPID
WinWait % "ahk_pid " tpPID
@TLMcode
TLMcode / debounce.js
Last active February 2, 2017 10:04
debounce function breaks Bootstrap Carosel "data-interval" option
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
@TLMcode
TLMcode / ClientSideCMSCredFuncs.js
Created January 25, 2017 22:00
some client side cred funcs for CMS plugin
// check for error / success messages
check_dom_msgs();
// register event listener module
var register = ( function() {
// cache DOM
var $form = $( '#form_reg' );
var $form_inputs = $form.find( 'input' ).not( '#reg_btn, #reg_hidden' );
var min_length = 5, max_length = 20, max_pw_length = 100;
@TLMcode
TLMcode / user_login_functions.php
Created January 25, 2017 21:26
Some user login functions
/*******
Function To:
Register Form And Processing Code - Display's And Processes Register Form
*******/
function user_login_register()
{
global $SITEURL;
$Feul = new Feul;
@TLMcode
TLMcode / Search_Files.ahk
Last active January 25, 2017 15:59
Search for string in files
#NoTrayIcon
PrefFile := A_ScriptDir "\prefs.txt"
TCtrlW := 250
if FileExist( PrefFile )
{
FileRead, Prefs, % PrefFile
For Each, Pref in ( StrSplit( Prefs, "~" ), SectionObj := {} )
@TLMcode
TLMcode / Turn Off Lenovo Trackpad Tap.ahk
Created January 13, 2017 04:35
Turn Off Lenovo Trackpad Tap
tpConf := A_ProgramFiles "\Elantech\ETDAniConf.exe"
Run % tpConf,,, tpPID
WinWait % "ahk_pid " tpPID
ControlClick, Button1, % "ahk_pid " tpPID
For Each, Control in [ "164", 160 ]
ControlSend, % "Static" Control, {Enter}, % "ahk_pid " tpPID
@TLMcode
TLMcode / GetTLDs.ahk
Last active September 15, 2017 14:35
Get TLDs using a http request
url = https://www.namecheap.com/domains/new-tlds/explore.aspx?page=
pgNum := 1
reqObj := ComObjCreate( "WinHttp.WinHttpRequest.5.1" )
reqObj.Open( "GET", url . pgNum, false ), reqObj.Send()
htmObj := ComObjCreate( "HTMLfile" ), htmObj.Write( reqObj.ResponseText )
PageCountCol := htmObj.getElementByID( "ctl00_ctl00_ctl00_ctl00_base_content_web_base_content_home_content_page_content_left_ctl06_pagerControl_Page_PageNumberDisplayDiv" )