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 Pokemon = () => { | |
const {id} = useParams(); | |
const pokemon = useMemo(async () => { | |
try { | |
cosnt results = await getPokemon(id); | |
return results.data; // or watever... | |
} catch (e) { | |
console.log('There was an error', e); | |
return null; | |
} |
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
try { | |
const response = await fetch("https://icanhazdadjoke.com/"); | |
// do something here with reponse. | |
} catch (e) { | |
// do somethign with the error. | |
} |
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 handleFiles = async (sourceDirectory, destination, results) => { | |
let index = 1; | |
const files = fs.readdirSync(sourceDirectory); | |
return Promise.all(files.map(async (filename) => { | |
return new Promise(async (resolve) => { | |
console.log(colors.yellow(`Process the file ${filename}`)); | |
const destinationPath = path.join(destination, `${filename.split('.')[0]}.json`); | |
if (fs.existsSync(destinationPath)) { |
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 PATH="$HOME/.rbenv/shims:$PATH" | |
export ANDROID_HOME="/Users/roy/Library/Android/sdk" | |
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools" | |
export COREPACK_ENABLE_AUTO_PIN=0 | |
# General aliases. | |
alias edit_aliases="fleet /Users/roysegall/.oh-my-zsh/custom/aliases.zsh" | |
alias reload_aliases="source ~/.zshrc" | |
alias video_to_gif="function video_to_gif(){ ffmpeg -i $1 $2 && gifsicle -O3 $2 -o $2 && say "Video is ready!"};video_to_gif" | |
alias www="cd /Users/roysegall/projects" |
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
<?xml version="1.0" ?><root> | |
<report><version>2</version><sessionid>b75c26072d27342c5f193efc</sessionid><type>desync</type><sku>ea.maxis.sims4_64.15.pc</sku><createtime>2020-07-23 11:07:25</createtime><buildsignature>Local.Unknown.Unknown.1.64.84.1020-1.200.000.455.Release</buildsignature><categoryid>commodity_tracker.py:36</categoryid><desyncid>b75c26072d27342c5f193efc</desyncid><systemconfig/><screenshot/><desyncdata>Exception in Sim Timeline: Exception running Element (TypeError: 'commodity_Motive_HygieneHands' object is not callable) Traceback (most recent call last): File "T:\InGame\Gameplay\Scripts\Server\scheduling.py", line 212, in simulate File "T:\InGame\Gameplay\Scripts\Server\alarms.py", line 260, in run File "/Users/a/sims4mods/Custom/TeleportAnySim_Script/Scripts/SimTeleporter.py", line 64, in max_commodities File "/Users/a/sims4mods/Custom/TeleportAnySim_Script/Scripts/SimTeleporter.py", line 40, in randomize_motive File "T:\InGame |
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
routes/ | |
├── __init__.py | |
└── user | |
├── __init__.py | |
└── login.py |
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 django.contrib import admin | |
from django.urls import path, include | |
from decorated_router.api.api import auto_register | |
urlpatterns = [ | |
path('admin/', admin.site.urls), | |
] | |
auto_register(urlpatterns) |
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
@url_decoration(re_path=r'^api/blog/(?P<blog_id>\d+)/?$', name="blog") | |
class BlogControllerForTests(View): | |
def get(self, request, blog_id): | |
return JsonResponse({'id': 1, 'title': f'Nice Blog {blog_id}'}) |
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
class BlogApiController extends AbstractController | |
{ | |
/** | |
* @Route("/api/posts/{id}", methods={"GET","HEAD"}) | |
*/ | |
public function show(int $id) | |
{ | |
// ... return a JSON response with the post | |
} |
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 django.urls import path | |
from . import views | |
urlpatterns = [ | |
path('articles/2003/', views.special_case_2003), | |
path('articles/<int:year>/', views.year_archive), | |
path('articles/<int:year>/<int:month>/', views.month_archive), | |
path('articles/<int:year>/<int:month>/<slug:slug>/', views.article_detail), | |
] |
NewerOlder