Skip to content

Instantly share code, notes, and snippets.

/**
* This function trims a string of leading and trailing whitespace.
* @return {String} The string stripped of whitespace from both ends.
* @see MDN's <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/Trim">trim documentation</a>.
*/
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g, '');
};
}
@jayliu50
jayliu50 / slackDownloadThenDelete.py
Last active January 27, 2016 23:23
Download then delete files older than 14 days from Slack
import sys
import requests
import json
import calendar
from datetime import datetime, timedelta
# This script will download, then delete the non-external files older than 14 days.
_token = "" # administrator token, from https://api.slack.com/web
_project = "" # project name, from http://[project].slack.com
@jayliu50
jayliu50 / image-in-svg.rb
Last active June 5, 2017 17:09
Make images contained within SVG files (exported through Sketch) not look washed out.
#!/usr/bin/env ruby
# usage: ruby image-in-svg.rb MY-IMAGE.svg
require 'nokogiri'
require 'mini_magick'
require 'base64'
## colorization
class String
@jayliu50
jayliu50 / convert_goodreads_csv.rb
Last active September 24, 2017 06:10
Given goodreads CSV and Selenium HTML Test case template, batch create test cases that can fill out forms with book's data. Usage: `convert_goodreads_csv.rb [your CSV] [your HTML template]`
#! /usr/bin/env ruby
require 'csv'
require 'fileutils'
class String
# colorization
def colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
@jayliu50
jayliu50 / BPL.html
Created September 23, 2017 08:54
Selenium IDE Test Case: test to see if book is in BPL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://bpl.bibliocommons.com/" />
<title>BPL-{{{Title}}}</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
@jayliu50
jayliu50 / ILL.html
Created September 23, 2017 08:55
Selenium IDE Test Case: test to fill out ILL request form
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="https://illiad-bpl-org.ezproxy.bpl.org/" />
<title>ILL-{{{Title}}}</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
@jayliu50
jayliu50 / Convert .mov or .MP4 to .gif.md
Last active April 1, 2022 23:17 — forked from mcmoe/Convert .mov or .MP4 to .gif.md
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This note is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@jayliu50
jayliu50 / package.json
Last active September 11, 2022 06:44
Jay Liu Design
{
"name": "gatsby-theme-endeavors",
"private": true,
"version": "0.0.1",
"keywords": [
"Jay Liu"
],
"dependencies": {
"@kennethormandy/react-fittext": "^0.6.0",
"@mattjennings/react-modal": "^1.0.2",