Skip to content

Instantly share code, notes, and snippets.

View RoySegall's full-sized avatar
⌨️
God is a coder

Roy Segall RoySegall

⌨️
God is a coder
View GitHub Profile
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;
}
try {
const response = await fetch("https://icanhazdadjoke.com/");
// do something here with reponse.
} catch (e) {
// do somethign with the error.
}
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)) {
# General aliases.
alias edit_aliases='code /Users/roy/.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/roy/projects'
# the fuck - https://github.com/nvbn/thefuck#installation
eval $(thefuck --alias)
<?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)&#13;&#10;Traceback (most recent call last):&#13;&#10; File "T:\InGame\Gameplay\Scripts\Server\scheduling.py", line 212, in simulate&#13;&#10; File "T:\InGame\Gameplay\Scripts\Server\alarms.py", line 260, in run&#13;&#10; File "/Users/a/sims4mods/Custom/TeleportAnySim_Script/Scripts/SimTeleporter.py", line 64, in max_commodities&#13;&#10; File "/Users/a/sims4mods/Custom/TeleportAnySim_Script/Scripts/SimTeleporter.py", line 40, in randomize_motive&#13;&#10; File "T:\InGame
routes/
├── __init__.py
└── user
├── __init__.py
└── login.py
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)
@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}'})
class BlogApiController extends AbstractController
{
/**
* @Route("/api/posts/{id}", methods={"GET","HEAD"})
*/
public function show(int $id)
{
// ... return a JSON response with the post
}
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),
]