Skip to content

Instantly share code, notes, and snippets.

View Jaironlanda's full-sized avatar
🥷

Jairon Landa Jaironlanda

🥷
View GitHub Profile
@Jaironlanda
Jaironlanda / main.dart
Created April 17, 2023 05:46
Flutter Statefull template
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My Stateful App',
home: MyStatefulWidget(),
@Jaironlanda
Jaironlanda / main.dart
Created April 17, 2023 05:45
Flutter Stateless template
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'My Stateless App',
home: MyStatelessWidget(),
@Jaironlanda
Jaironlanda / openai-api.py
Created January 25, 2023 13:40
OpenAI Error Handling
import openai, openai.error
try:
#Make your OpenAI API request here
response = openai.Completion.create(model="text-davinci-003",
prompt="Hello world")
except openai.error.Timeout as e:
#Handle timeout error, e.g. retry or log
print(f"OpenAI API request timed out: {e}")
pass
@Jaironlanda
Jaironlanda / project-2.py
Created June 7, 2021 15:01
Count max word in list
text = ['this is me elon musk', 'this is long text from elon musk']
count = 0
for w in text:
count = max(count, len(w.split(' ')))
print("Max words: " str(count))
@Jaironlanda
Jaironlanda / project-1.py
Created June 6, 2021 13:55
Calculate word in list() by using word_tokenize
import pandas as pd
from nltk.tokenize import word_tokenize
text = ["this is me jairon landa", "This is the 2nd text"]
text_len = len(text)
print("total text: " + str(text_len))
number_of_word = 0
for i in range(0, text_len):
data_text = word_tokenize(text[i])
@Jaironlanda
Jaironlanda / php_array-1.php
Created October 15, 2020 14:20
PHP array merge
<?php
$array = array(
"1" => "PHP code tester Sandbox Online",
"foo" => "bar", 5 , 5 => 89009,
"case" => "Random Stuff: " . rand(100,999),
"PHP Version" => phpversion()
);
// adding new array with value
// variable name must same
$array['name'] = "Jaironlanda";
@Jaironlanda
Jaironlanda / httpd-vhost.conf
Last active September 29, 2022 19:20
Virtual Host configuration for CodeIgniter 4
NameVirtualHost *:80
<VirtualHost *:80>
ServerName ci4site.test
DocumentRoot "C:/xampp/htdocs/mysite-project/public"
<Directory "C:/xampp/htdocs/mysite-project/public">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
@Jaironlanda
Jaironlanda / text_replace.php
Created May 5, 2020 05:21
Example str_replace with array in PHP
<?php
$data = array(
"Jairon Landa",
"Coding",
"Tuaran"
);
$field = array(
"[name]",
"[hobby]",
@Jaironlanda
Jaironlanda / practice1-lab2-OS.c
Created February 28, 2020 13:51
Operating System Lab 2
#include <stdio.h>
#include <string.h>
// function declaration
void display_menu();
double determine_price(char *order);
double calculate_bill(double price1, int qty1,double price2, int qty2, double price3, int qty3);
int main(){
char customer_name[100];
@Jaironlanda
Jaironlanda / google_smtp_config.php
Created May 26, 2018 14:07
Codeigniter 3 SMTP Google configuration
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_user' => 'enteryourgoogleemail', //google email
'smtp_pass' => 'enteryourpassword', //your email password here
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => TRUE,
'newline' => "\r\n",