This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useMemo, useState } from 'react'; | |
export interface useLocalStorageProps<T> { | |
id: string; | |
defaultValue: T; | |
} | |
export interface useLocalStorageReturn<T> { | |
setValue: (value: T) => void; | |
value: T; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({url:"https://graph.facebook.com/{PAGE-ID}/feed?access_token={APP-ID}|{APP-SECRET}&fields=picture,full_picture,message,created_time", success: function (r) { | |
var html = "", | |
item; | |
console.log(r); | |
for (var i = 0; i < r.data.length; i++) { | |
item = r.data[i]; | |
html = html + '<div class="item">'; | |
if (item.picture) { | |
html = html + '<img src="' + item.full_picture + '">'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function animateVerticalScroll(px, scope, callback, options) { | |
var time, | |
callbackCalled = false, | |
obj; | |
options = options || {}; | |
options.time = options.time || 1000; | |
currScroll = scope.scrollTop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateEmail(email) { | |
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
return email.match(re); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isSequentialNumber(code, reversed) { | |
var codeArr = code.split(''), | |
i, | |
total = codeArr.length; | |
if (reversed) { | |
codeArr = codeArr.reverse(); | |
} | |
for (i = 0; i < total - 1; i = i + 1) { | |
if (Number(codeArr[i + 1]) !== Number(codeArr[i]) + 1) { | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addMinDecimal(n, minDecimal) { | |
var numberArr = String(n).split(''), | |
i, | |
total = minDecimal - numberArr.length, | |
zeros = ''; | |
if (total > 0) { | |
for (i = 0; i < total; i = i + 1) { | |
zeros = zeros + '0'; | |
} | |
} |