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 _ from "lodash" | |
import React from "react" | |
import moment from "moment" | |
import { connect } from "react-redux" | |
import API from "@Services/Api/profile" | |
import { ApiManager } from "../../api/apiManager" | |
import ParsedText from "react-native-parsed-text" | |
import { NavigationEvents } from "react-navigation" | |
import { DateToWordsFromNow } from "../../helpers/helper" | |
import { ACTIVITY_NOTIFICATION } from "../../api/constants" |
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 _ from "lodash"; | |
import React from 'react'; | |
import moment from 'moment'; | |
import { connect } from 'react-redux'; | |
import API from '@Services/Api/profile'; | |
import { ApiManager } from "../../api/apiManager"; | |
import ParsedText from 'react-native-parsed-text'; | |
import { NavigationEvents } from "react-navigation"; | |
import { DateToWordsFromNow } from '../../helpers/helper'; | |
import { ACTIVITY_NOTIFICATION } from "../../api/constants"; |
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 getCurrentPosition(options) { | |
return new Promise(function(resolve, reject) { | |
navigator.geolocation.getCurrentPosition(resolve, reject, options); | |
}); | |
} | |
(async () => { | |
const position = await getCurrentPosition().catch(err => console.log(err)); | |
console.log(position); | |
})(); |
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
/** | |
* Small debounce function. | |
* | |
* by Christian C. Salvadó <c@cms.gt> | |
* MIT Style license, 2019 | |
*/ | |
function debounce(fn, ms = 0) { | |
let timer = 0 |
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
export default function fetchWithTimeout(url, options, timeout = 3000) { | |
const controller = new AbortController() | |
const { signal } = controller | |
setTimeout(() => controller.abort(), timeout) | |
return fetch(url, { ...options, signal }) | |
} |
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 capitalizeSentence(str) { | |
return str.replace(/^\w|(\s\w)/g, function(match, index) { | |
return match.toUpperCase() | |
}); | |
} | |
capitalizeSentence('Lorem ipsum dolor sit amet, consectetur adipiscing elit.'); | |
// "Lorem Ipsum Dolor Sit Amet, Consectetur Adipiscing Elit." |
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
// Using Array.prototype.reduce: | |
const getChunks = (array, size) => { | |
return array.reduce((acc, curr, i) => { | |
const pos = Math.floor(i/size); | |
acc[pos] = [...(acc[pos]||[]), curr]; | |
return acc | |
}, []) | |
} | |
// Using Array.from: |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<link rel="stylesheet" href="https://cdn.rawgit.com/konpa/devicon/df6431e323547add1b4cf45992913f15286456d3/devicon.min.css"> | |
<link href='//cdn.jsdelivr.net/devicons/1.8.0/css/devicons.min.css' rel='stylesheet'> | |
<style> | |
body { |
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
using System.Linq; | |
using System.Text.RegularExpressions; | |
using ServiceStack; | |
using ServiceStack.Text; | |
var mysisRef = "360T364827992x"; | |
var _360tRef = Get360TReference(mysisRef); | |
_360tRef.PrintDump(); | |
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
USE AdventureWorks | |
GO | |
--============== Supporting function dbo.udfGetFullQualName | |
IF OBJECT_ID('dbo.udfGetFullQualName') IS NOT NULL | |
DROP FUNCTION dbo.udfGetFullQualName | |
GO | |
CREATE FUNCTION dbo.udfGetFullQualName ( @ObjectId INTEGER ) |
NewerOlder