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
| let url = 'https://host.test/path/here.filetype?query=string&more=params#anchor'; | |
| const querystringStart = url.indexOf('?'); | |
| const anchorStart = url.indexOf('#'); | |
| const querystring = url.slice(querystringStart + 1, anchorStart); | |
| let querystringParams = querystring.split('&'); | |
| let newQuerystringParams = []; | |
| querystringParams.forEach((queryparam, i) => { | |
| let param = queryparam.split('='); | |
| if (param[0] !== 'more') { | |
| newQuerystringParams.push(`${param[0]}=${param[1]}-changed`) |
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
| cdxt --cc --limit 100 --filter '=status:200' iter 'github.com/*' |
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 idp_data.idp_data.models import Event, EventAction | |
| id = '103' | |
| original_event = Event.objects.get(pk=id) | |
| new_event = Event.objects.get(pk=id) | |
| new_event.pk = None | |
| new_event.id = None | |
| new_event._state.adding = True | |
| new_event.save() |
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
| d = {'a': True, 'b': False} | |
| # Without assignment expressions | |
| if d['a']: | |
| a = d['a'] | |
| print(a) | |
| # => True | |
| if d['b']: | |
| b = d['b'] |
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
| // Firefox | |
| Date.parse('2021-03-03 06:00') | |
| //=> 1614744000000 | |
| // Chrome | |
| Date.parse('2021-03-03 06:00') | |
| //=> 1614751200000 | |
| // Safari | |
| Date.parse('2021-03-03 06:00') |
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
| #main.rb | |
| class Super | |
| def initialize(val) | |
| @val = val | |
| end | |
| def val? | |
| @val | |
| end | |
| end |
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
| #Credit: https://twitter.github.io/birdwatch/about/ranking-notes/ | |
| import pandas as pd | |
| notes = pd.read_csv("notes-00000.tsv", sep="\t") | |
| ratings = pd.read_csv("ratings-00000.tsv", sep="\t") | |
| ratingsWithNotes = notes.set_index("noteId").join( | |
| ratings.set_index("noteId"), lsuffix="\_note", rsuffix="\_rating", how="inner" | |
| ) | |
| ratingsWithNotes["numRatings"] = 1 |
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
| #.github/workflow/test.yaml | |
| on: [push] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Test | |
| run: | |
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
| #Dockerfile | |
| #model_artifacts image | |
| FROM python:3.7.7-slim-buster AS model_artifacts | |
| WORKDIR /artifacts | |
| ADD https://bucketname.s3-eu-west-1.amazonaws.com/really_big_model_1.h5 . | |
| ADD https://bucketname.s3-eu-west-1.amazonaws.com/really_big_model_2.h5 . | |
| #app image | |
| FROM python:3.7.7-slim-buster AS app | |
| ... |
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
| //example1.js | |
| const func1 = (foo, bar)=> { | |
| const num1 = Math.pow(foo, 2) | |
| const num2 = Math.pow(bar, 2) | |
| } | |
| //example2.js | |
| const func1 = (foo, bar)=> { | |
| const num1 = foo **2 | |
| const num2 = bar **2 |