Skip to content

Instantly share code, notes, and snippets.

View sanchezcarlosjr's full-sized avatar
🏛️
Studying computer science

Carlos Eduardo Sanchez Torres (sanchezcarlosjr) sanchezcarlosjr

🏛️
Studying computer science
View GitHub Profile
@sanchezcarlosjr
sanchezcarlosjr / main.py
Created August 11, 2019 04:31
As developer I wanna learn about Gist For I get it
def main():
return "Hello world";
@sanchezcarlosjr
sanchezcarlosjr / NgxsFirestorePagination.ts
Created June 4, 2020 02:06
Paginate data with query cursors from Firestore and Angular
import { NgxsFirestore } from './ngxs-firestore.service';
import { BehaviorSubject, Observable } from 'rxjs';
import { QueryFn } from '@angular/fire/firestore';
import { map, take } from 'rxjs/operators';
class QueryPagination {
private lastVisible: any = null;
constructor(queryFn: QueryFn, private orderBy: string, private limit: number, private orderByDirection?: any) {
this.setQuery(queryFn);
@sanchezcarlosjr
sanchezcarlosjr / news.database.ts
Last active June 4, 2020 02:33
Using NgxsFirestorePagination
import { NgxsFirestorePagination} from '@ngxs-labs/firestore-plugin';
@Injectable({
providedIn: 'root'
})
export class RacesService extends NgxsFirestorePagination<RacesStateModel> {
path = 'Races';
orderBy = 'created_at';
orderByDirection = 'desc';
format: (data) => data; //Each document format
@sanchezcarlosjr
sanchezcarlosjr / news.component.html
Last active June 4, 2020 02:38
Getting data from Firestore and Fetching
<div>
<div *ngFor="let article of articles | async">
<h1>{{article.title}}</h1>
<p><{{article.content}}/p>
<p>{{article.created_at}}</p>
</div>
</div>
<-- Whatever component -->
<ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)">
@sanchezcarlosjr
sanchezcarlosjr / app.module.ts
Last active June 4, 2020 02:48
Context pagination firestore pagination
import { AngularFireModule } from '@angular/fire';
import { NgxsModule } from '@ngxs/store';
import { NgxsStoreModule } from '../store/store.module';
@NgModule({
declarations: [AppComponent],
imports: [
//...
AngularFireModule.initializeApp(environment.firebase),
NgxsStoreModule
],
@sanchezcarlosjr
sanchezcarlosjr / julia-installer.sh
Last active June 6, 2020 17:43
Julia Installer (Ubuntu 16.04 or above)
sudo pwd && cd ~/Downloads && wget -q -O- https://julialang.org/downloads/ | grep -Po '(?<=href=")[^"]*' | grep ^https://julialang-s3.julialang.org/bin/linux/x64/ | head -1 | xargs wget -O julia-x86_64.tar.gz && mkdir julia-x86_64 && tar -xvzf julia-x86_64.tar.gz -C julia-x86_64 --strip-components 1 && sudo cp -r julia-x86_64 /opt/ && sudo ln -s /opt/julia-x86_64/bin/julia /usr/local/bin/julia && julia
@sanchezcarlosjr
sanchezcarlosjr / Dialogflow.ts
Last active July 20, 2020 21:27
How to create a bot on Whatsapp?
import * as dialogflow from '@google-cloud/dialogflow';
import { uuid } from 'uuidv4';
import { NaturalProcessorLanguage } from '../domain/NaturalProcessorLanguage';
import * as protos from '@google-cloud/dialogflow/build/protos/protos';
export class Dialogflow implements NaturalProcessorLanguage {
private responses:
[protos.google.cloud.dialogflow.v2.IDetectIntentResponse,
protos.google.cloud.dialogflow.v2.IDetectIntentRequest | undefined, {} | undefined];
async detectIntent(text: string, sessionId: string = uuid()): Promise<string> {
@sanchezcarlosjr
sanchezcarlosjr / index.php
Created November 14, 2020 16:20
CURP API - Government infraestructure
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://us-west4-arsus-production.cloudfunctions.net/curp?curp=CAHF620818HMNLNL09&apiKey=pT32raieZC3');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();

Keybase proof

I hereby claim:

  • I am sanchezcarlosjr on github.
  • I am cest (https://keybase.io/cest) on keybase.
  • I have a public key ASArAlpB_HsLRSSA3UWi0UiRLb8yy02XDRPSI6_W1WCPIgo

To claim this, I am signing this object:

@sanchezcarlosjr
sanchezcarlosjr / 1-1-1-numerical-analysis-mathematical-preliminaries-and-error-analysis.ipynb
Last active February 5, 2022 19:50
1.1.1 Numerical Analysis Mathematical preliminaries and Error Analysis .ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.