Skip to content

Instantly share code, notes, and snippets.

View mkubdev's full-sized avatar
🌶️

Maxime Kubik mkubdev

🌶️
View GitHub Profile
@mkubdev
mkubdev / Forest.jsx
Created June 17, 2024 13:57 — forked from ektogamat/Forest.jsx
A simple FakeForest Component for React Three Fiber by Anderson Mancini
/*
Copyright(c) June 2024 Anderson Mancini
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@mkubdev
mkubdev / fix_json.py
Created October 4, 2023 10:07
Fix json of an exported mongo collection
import re
# Read the incorrect JSON file
with open('jobs.json', 'r') as file:
data = file.read()
# Add commas between documents
fixed_data = re.sub(r'}\s*{', '},\n{', data)
# Write the fixed JSON to a new file
import { Component, OnInit, OnDestroy } from '@angular/core';
import { PageService } from 'services/page.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
contents: any = [];
.page-section {
padding: 6rem 0;
}
.page-section h2.section-heading {
font-size: 2.5rem;
margin-top: 0;
margin-bottom: 1rem;
}
<section class="page-section bg-light" id="portfolio">
<div *ngIf="page" class="container">
<div class="text-center">
<h2 class="section-heading text-uppercase">{{page.Name}}</h2>
<h3 class="section-subheading text-muted">How to build a simple blog in 10min with Strapi</h3>
</div>
<h4>{{page.content.Title}}</h4>
<div>{{page.content.Value}}</div>
<br/>
<app-post></app-post>
import { Component, OnInit } from '@angular/core';
import { PostService } from 'services/post.service';
@Component({
selector: 'app-post',
templateUrl: './post.component.html',
styleUrls: ['./post.component.scss']
})
export class PostComponent implements OnInit {
posts: any = [];
#post .post-item {
max-width: 25rem;
}
#post .post-item .post-caption {
padding: 1.5rem;
text-align: center;
background-color: #f6f6f6;
}
<div *ngIf="posts" class="row">
<div *ngFor="let post of posts" class="col-lg-4 col-md-4 col-sm-6">
<div class="post-item">
<a class="post-link">
<img class="img-fluid" src="http://localhost:1337{{post.content.CoverImage[0].url}}" alt="" /></a>
<div class="post-caption">
<div class="post-caption-heading">{{post.content.Title}}</div>
<div class="post-caption-subheading text-muted">{{post.content.Value}}</div>
</div>
</div>
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../src/environments/environment';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class ContentService {
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { environment } from '../src/environments/environment';
import { map } from 'rxjs/operators';
@Injectable({
providedIn: 'root'
})
export class PostService {