Skip to content

Instantly share code, notes, and snippets.

View IOIO72's full-sized avatar
🚂

Tamio Honma IOIO72

🚂
View GitHub Profile
(function app() {
const event = {
init() {
$(document).ready(this.onDomReady);
},
onDomReady() {
}
};
const view = {
init() {
Sub Extract()
Dim prsThis As Presentation
Dim prsThat As Presentation
Dim sldThis As Slide
Dim sldThat As SlideRange
Dim nss As NamedSlideShow
Dim strName As String
Dim i As Integer
Set prsThis = ActivePresentation
@IOIO72
IOIO72 / tinycli.babel
Last active July 30, 2016 14:05
TinyCLI
(function app() {
const event = {
init() {
view.$document.ready(this.onDomReady);
view.$body.on('keyup', this.onKeyUp)
.on('keydown', this.onKeyDown)
.on('keypress', this.onKeyPress);
this.initPrompt();
view.$window.on('scroll touchmove mousewheel', this.onScroll);
},

Keybase proof

I hereby claim:

  • I am ioio72 on github.
  • I am tamio (https://keybase.io/tamio) on keybase.
  • I have a public key ASDaC35YE-ue720vnP0n6NdQZq3vbDxlqlJTVJGtgMBDuwo

To claim this, I am signing this object:

@IOIO72
IOIO72 / Get First Name
Last active February 25, 2019 18:21
Extract first name out of string of full name
/*
* getFirstName extracts the first name out of a string of the full name.
* Examples (input -> result):
* 'Tim Berners-Lee' -> 'Tim'
* 'Berners-Lee, Tim' -> 'Tim'
* 'Tim' -> 'Tim'
* */
const getFirstName = names => {
const reg = new RegExp('.*, ([a-zA-Z-]*)|([a-zA-Z-]*) .*', 'i');
const result = reg.exec(names);
@IOIO72
IOIO72 / SortByOutline
Created May 9, 2019 12:34
Sort items by two digit outlines
const faq = [
{
outline: "3.2",
question: "Hello John?",
answer: "Yes!"
},
{
outline: "1.1",
question: "Hello Julia?",
answer: "Hi!"
@IOIO72
IOIO72 / sortCompare
Created May 10, 2019 08:26
Compares two values and returns the sort direction for the sort() function. Use the `order` parameter with one of the values `1` or `-1` to change sort direction.
const sortCompare = (a, b, order = 1) => {
if (a > b) return order;
if (a < b) return order * -1;
return 0;
};
@IOIO72
IOIO72 / getValuesUnique
Created May 10, 2019 08:28
Returns each value of a given array once in a set of unique values.
const getValuesUnique = arr => [...new Set(arr)];
@IOIO72
IOIO72 / fillWithCharBefore
Created May 10, 2019 09:22
Returns a string of a given length and fills uo missing characters with a specified character before the string.
const fillWithCharBefore = (str, len, chr = '0') => (str.length <= len) ? `${chr.repeat(len - str.length)}${str}` : str;
@IOIO72
IOIO72 / convertToArray
Created May 10, 2019 14:28
Takes any object and returns it as an array or returns the same given array
const convertToArray = any => (Array.isArray(any)) ? any : [any];