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 getDigitAt(position, value) { | |
return Math.floor((value % 10 ** position) / 10 ** (position - 1)); | |
} | |
function getLength(value) { | |
return Math.floor(Math.log10(value)) + 1; | |
} | |
function isPalindrome(value) { | |
const digits = getLength(value); |
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
async function getAllMyData() { | |
const rootResponse = await fetch('https://www.myapi.com/foo', { ... }); | |
const rootData = await rootResponse.json(); | |
// this gets all the ids we need for the nested requests from the data | |
// in the first request | |
const ids = rootData.bars.map(bar => bar.id); | |
// fetch all the details of all the bar objects. This makes multiple |
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 ElasticSwiftCore | |
import Foundation | |
import Network | |
import Logging | |
import NIOHTTP1 | |
/** | |
Class maintaining URLSession for a Host | |
*/ |
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
{ | |
"files.associations": { | |
"*.ejs": "html", | |
"*.jsx": "javascriptreact" | |
}, | |
"scss.validate": false, | |
"prettier.requireConfig": true, | |
"[typescript]": { | |
"editor.defaultFormatter": "esbenp.prettier-vscode" | |
}, |
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 React from 'react'; | |
import MyButton from './MyButton'; | |
export default function MyComponent(props) { | |
return (<div>Hello, world! <MyButton>Click Here</MyButton></div>); | |
} |
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
<?php | |
$functions = [ | |
'mail', | |
'strlen', | |
'strpos', | |
'strrpos', | |
'substr', | |
'strtolower', | |
'strtoupper', |
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
const fs = require('fs'); | |
// read | |
fs.readFile('composer.json', 'utf8', (err, contents) => { | |
if (err) { | |
console.log('File could not be read'); | |
} else { | |
try { | |
// parse | |
const json = JSON.parse(contents); |
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 vim extensions | |
set nocompatible | |
" syntax highlighting | |
syntax on | |
" user-friendly backspace | |
set backspace=indent,eol,start | |
" show command on last line of screen |
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 DS from 'ember-data'; | |
import Ember from 'ember'; | |
export default DS.Model.extend({ | |
createdAt: DS.attr('date'), | |
updatedAt: DS.attr('date'), | |
firstName: DS.attr('string'), | |
lastName: DS.attr('string'), | |
suffix: DS.attr('string'), | |
company: DS.attr('string'), |
NewerOlder