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 axios = require('axios'); | |
let cache; | |
async function foo(x) { | |
if (cache) { | |
console.log('using cache', x); | |
return cache; | |
} | |
cache = axios.get('https://jsonplaceholder.typicode.com/users').then((resp) => resp.data[0].name); |
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
from pprint import pprint | |
import requests | |
if __name__ == '__main__': | |
pprint(requests.get('https://api.appcast.io/search', params={ | |
'token': '<token>', | |
'city': 'New York', | |
'state': 'NY', | |
'r': '1miles', |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
1. Open Terminal | |
2. sudo easy_install pip | |
3. pip install --user requests | |
4. pip install --user requests_threads | |
5. pip install --user beautifulsoup4 | |
6. pip install --user --upgrade pyopenssl |
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
##### | |
# The sum of the middle two digits is a Square Number. | |
# The sum of the middle four digits is a Cube number | |
# The net difference between the first and tenth digit is 2 | |
# The net difference between the second and ninth digit is 3 | |
# The net difference between the third and eighth digit is 4 | |
# The sum of the first five digits is a Prime number | |
# The sum of the last five digits is a Triangular number | |
# The sum of the digits in odd positions (first, third, fifth, seventh and ninth digits) is an Odd number | |
# The digit 4 is in first 5 positions |
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
├─┬ [email protected] | |
│ ├─┬ [email protected] | |
│ │ ├── [email protected] | |
│ │ ├── [email protected] | |
│ │ ├── [email protected] | |
│ │ ├── [email protected] | |
│ │ └── [email protected] | |
│ ├─┬ [email protected] | |
│ │ ├── [email protected] | |
│ │ └── [email protected] |
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
# vim: set fileencoding=utf8 | |
''' | |
References | |
- http://stackoverflow.com/a/1966188 | |
- http://en.wikipedia.org/wiki/Tree_(data_structure) | |
$ python suggest.py prefix | |
''' | |
import sys | |
import redis |