This file contains hidden or 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
| // Inspired by https://twitter.com/coderitual/status/1112297299307384833 and https://tapajyoti-bose.medium.com/7-killer-one-liners-in-javascript-33db6798f5bf | |
| // Remove any duplicates from an array of primitives. | |
| const unique = [...new Set(arr)] | |
| // Sleep in async functions. Use: await sleep(2000). | |
| const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms))); | |
| // or | |
| const sleep = util.promisify(setTimeout); |
This file contains hidden or 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
| // Program for cloning repos at a specific place on your computer | |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "net/url" | |
| "os" | |
| "os/exec" | |
| "path/filepath" |
This file contains hidden or 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 arcgis.features import GeoAccessor, FeatureLayer | |
| from arcgis.geometry import Geometry | |
| from arcgis.gis import GIS | |
| import pandas as pd | |
| import os | |
| import re | |
| def get_dataframe(in_features, gis=None): | |
| """ |
- https://fishshell.com/ - my default shell, i use theme bobthefish
- https://www.sublimetext.com/ - my default editor
- Material Theme
- Operator font
- Packages: Emmet, Hayaku, SidebarEnhancements, JS Snippets, GSAP Snippets
- Sublime snippet for comments
- Sublime icon
- https://code.visualstudio.com/ - trying to switch, but not yet
If you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).
-
Shift+Enterrun selected cell or cells - if no cells below, insert a code cell below -
Ctrl+Btoggle hide/show left sidebar -
Ctrl+Ssave and checkpoint -
Ctrl+Shift+Ssave as
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 pandas as pd | |
| if __name__ == '__main__': | |
| # Override default pandas configuration | |
| pd.options.display.width = 0 | |
| pd.options.display.max_rows = 10000 | |
| pd.options.display.max_info_columns = 10000 | |
| # Open example data. | |
| df = pd.read_csv('employee_data.csv') |
This file contains hidden or 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
| ########################################################### | |
| # How to NEVER use lambdas. An inneficient and yet educa- # | |
| # tonal [sic] guide to the proper misuse of the lambda # | |
| # construct in Python 3.x. [DO NOT USE ANY OF THIS EVER] # | |
| # original by (and apologies to): e000 (13/6/11) # | |
| # now in Python 3 courtesy of: khuxkm (17/9/20) # | |
| ########################################################### | |
| ## Part 1. Basic LAMBDA Introduction ## | |
| # If you're reading this, you've probably already read e000's |
This file contains hidden or 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 os | |
| filename = 'homework.txt' | |
| if not os.path.exists(filename): | |
| with open(filename, 'w'): pass | |
| answer1 = """1). | |
| X | 3 | X | |
| ____|____|____ |