Skip to content

Instantly share code, notes, and snippets.

View Lwdthe1's full-sized avatar

Lincoln W Daniel Lwdthe1

View GitHub Profile
@Lwdthe1
Lwdthe1 / License.txt
Last active March 31, 2016 22:28
A jQuery function to run a function when an element is long pressed
DO WHATEVER YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Lincoln W Daniel <http://lincolnwdaniel.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@Lwdthe1
Lwdthe1 / License.txt
Last active March 31, 2016 22:30
A jQuery function used to check if a html element's parent div has a light background-color (or "background").
DO WHATEVER YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Lincoln W Daniel <http://lincolnwdaniel.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@Lwdthe1
Lwdthe1 / License.txt
Last active March 31, 2016 22:30
A jQuery function to add a actionable child element (the hider) to a parent element (the hidee). When clicked, the hider will hide the hidee. Raw
DO WHATEVER YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2016 Lincoln W Daniel <http://lincolnwdaniel.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@Lwdthe1
Lwdthe1 / jquery.setDoubleTap.js
Last active May 9, 2016 20:27
A simple jQuery function to capture double tap (or click) event on an element.
(function($){
$.fn.setDoubleTap = function(doubleTap){
var lastTapTime;
var doDoubleTap = function() {
//set the time of this click
var timeNow = new Date().getTime();
//calculate the time since last click
var timeSinceLastTap = timeNow - lastTapTime;
//check if it's been long enough to deem this click a part of a double tap sequence

03:33:51 prompt > Where do you want to load your phone book from? File name:

book 03:33:54 debug > Loading phone book from book.txt failed. No phone book found at that directory.

03:33:54 message > Opened a new phone book at book

03:33:54 message > Menu: Enter | Action 1 to View Contacts

03:37:26 prompt > Where do you want to load your phone book from? File name:

book 03:37:29 message > Loaded your book phone book of 1 contacts.

03:37:29 message > Contacts: < lincoln: 9165551234 > | < kate: 5135554321 > |

03:37:29 prompt > What do you want to do?

function copyTextToClipboard(text) {
var textArea = document.createElement("textarea");
//
// *** This styling is an extra step which is likely not required. ***
//
// Why is it here? To ensure:
// 1. the element is able to have focus and selection.
// 2. if element was to flash render it has minimal visual impact.
// 3. less flakyness with selection and copying which **might** occur if
@Lwdthe1
Lwdthe1 / selectBookmarks.js
Last active August 21, 2017 21:52
Select Chrome bookmarks to act on (delete, etc.) at chrome://bookmarks/#p=/me&hl=en-US
function run378268() {
var xcczxc = document.getElementsByClassName('col-list-checkbox')
for (var i = 0; i < xcczxc.length; i++) {
if(xcczxc[i].clicked == true) continue
xcczxc[i].click()
xcczxc[i].clicked = true
}
window.scroll(0,500)
}
var run378268Interval = setInterval(() => {
function convertCase(s, toDelim) {
if (!s || !s.length) return s
var existingType, lastFoundDelim = -1, camelCaseIndex = {}
if(s.indexOf(' ') > -1) existingType = ' ';
if(s.indexOf('-') > -1) existingType = '-';
if(s.indexOf('_') > -1) existingType = '_';
if(s.indexOf('.') > -1) existingType = '.';
if(!existingType) {
for(var i = 0; i < s.length; i++) {
@Lwdthe1
Lwdthe1 / parseEntities.js
Last active January 15, 2018 02:15
Angular directive for parsing links and username mentions in text and converting to html elements
// example html: <p parse-entities data-parse-entities-url="_blank" data-parse-entities-mentions="true" ng-model="message.text"></p>
angularApp
.directive('parseEntities', function () {
var mentionPattern = /\B@[a-z0-9_-]+/gi;
var urlPattern = /[\w-]+(\.[\w-]+)+([\w.,@?^=%&amp;:\/~+#-]*[\w@?^=%&amp;\/~+#-])?/gi;
const VALID_ANCHOR_TARGETS = {'_self': '_self', '_blank': '_blank'}
VALID_ANCHOR_TARGETS['self'] = VALID_ANCHOR_TARGETS['_self']
VALID_ANCHOR_TARGETS['blank'] = VALID_ANCHOR_TARGETS['_blank']
return {