Skip to content

Instantly share code, notes, and snippets.

View lelinhtinh's full-sized avatar
🤤
Slimming failure

Thành Thân Thiện lelinhtinh

🤤
Slimming failure
  • Da nang, Vietnam
  • 01:09 (UTC +07:00)
View GitHub Profile
@lelinhtinh
lelinhtinh / centos7-gnome-shell-extensions.md
Created November 20, 2018 04:44
gnome-tweak-tool google-chrome-stable chrome-gnome-shell

Install GNOME Shell extensions on Centos 7

sudo yum update

gnome-tweak-tool

sudo yum install gnome-tweak-tool

google-chrome

// if Navigation Timing is not supported, fallback to Date.naw() called on start (sufficient in many cases)
// Date.now is also polyfilled
(function(p){
if(!Date.now)
Date.now = function(){return +new Date};
if (!p.now){
var start = (p.timing && p.timing.navigationStart) || Date.now();
p.now = function now(){
return Date.now() - start;
@lelinhtinh
lelinhtinh / jquery-ajax-blob-arraybuffer.js
Created July 16, 2018 11:58 — forked from aaronk6/jquery-ajax-blob-arraybuffer.js
This fork supports request headers and returns text data if the request fails.
/**
* Register ajax transports for blob send/recieve and array buffer send/receive via XMLHttpRequest Level 2
* within the comfortable framework of the jquery ajax request, with full support for promises.
*
* Notice the +* in the dataType string? The + indicates we want this transport to be prepended to the list
* of potential transports (so it gets first dibs if the request passes the conditions within to provide the
* ajax transport, preventing the standard transport from hogging the request), and the * indicates that
* potentially any request with any dataType might want to use the transports provided herein.
*
* Remember to specify 'processData:false' in the ajax options when attempting to send a blob or arraybuffer -
(function () {
'use strict';
if (location.host !== 'daynhauhoc.com') {
const checkHost = confirm('Bookmarklet does not work on this page.\nDo you want to open DayNhauHoc?');
if (checkHost) top.location.href = 'https://daynhauhoc.com';
return;
}
if (!Discourse.User.current()) {
@lelinhtinh
lelinhtinh / phalcon-manjaro.md
Last active April 7, 2018 13:51
Steps to install Phalcon on Manjaro 2018

Cài đặt Phalcon trên Manjaro

Cập nhật Manjaro

pacman -Syu

Yaourt

-- Adminer 4.3.1 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `districts`;
CREATE TABLE `districts` (
`id` char(3) COLLATE utf8_unicode_ci NOT NULL,
(function ($) {
var arr = [];
$('table[style="width:800px; border-collapse: collapse;"] tr').each(function () {
var $this = $(this),
$a = $this.find('a:first');
if($a.length) arr.push("'" + $this.find('a:last').text().toLowerCase().replace(/(\s|\W)/g, '-') + "' => '" + $a.attr('title') + "'");
});
console.log(arr.join(',\n'));
})(jQuery);
(function () {
fetch('/level/1', {
credentials: 'same-origin'
}).then(function (response) {
return response.text();
}).then(function (response) {
$('#password').val(response.match(/Password:\s+([\d\-]+)/)[1]);
});
})();
.wrap {
margin: 30px auto;
width: 90%;
font-family: 'Tahoma', san-serf;
font-size: 14px;
}
.title {
font-size: 1.7em;
font-weight: lighter;
@lelinhtinh
lelinhtinh / waitForKeyElements.js
Created September 12, 2017 13:07 — forked from BrockA/waitForKeyElements.js
A utility function, for Greasemonkey scripts, that detects and handles AJAXed content.
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
that detects and handles AJAXed content.
Usage example:
waitForKeyElements (
"div.comments"
, commentCallbackFunction
);