Skip to content

Instantly share code, notes, and snippets.

View atakde's full-sized avatar
🎯
Focusing

Atakan Demircioğlu atakde

🎯
Focusing
View GitHub Profile
import { onRequest } from 'firebase-functions/v2/https';
import { google } from 'googleapis';
import admin from 'firebase-admin';
import { setGlobalOptions } from 'firebase-functions/v2';
setGlobalOptions({
maxInstances: 1
});
admin.initializeApp();
@atakde
atakde / deploy.yml
Created January 20, 2024 08:31
PHP FTP Github Action
on: push
name: 🚀 Deploy website on push
jobs:
web-deploy:
name: 🎉 Deploy
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v3
import { onSchedule } from 'firebase-functions/v2/scheduler';
import { logger } from 'firebase-functions';
const sendEmailDummy = async (user) => {
logger.info(`Sending email to ${user.email}...`);
return new Promise((resolve, reject) => {
setTimeout(() => {
logger.info(`Email sent to ${user.email}!`);
resolve();
}, 1000);
@atakde
atakde / index.js
Created January 9, 2024 20:15
Firebase cloud functions example
import defaultRequest from './defaultRequest.js';
import reminderCron from './reminderCron.js';
export {
defaultRequest,
reminderCron,
// and other functions..
};
@atakde
atakde / admin.js
Created January 9, 2024 20:11
Firebase cloud function example
import admin from 'firebase-admin';
import { setGlobalOptions } from 'firebase-functions/v2';
setGlobalOptions({
maxInstances: 1
});
admin.initializeApp();
const db = admin.firestore();
const messaging = admin.messaging();
@atakde
atakde / boostEx.php
Created January 6, 2024 11:12
Elastic Boost Ex
<?php
$searchResults = $searchEngine->search(
[
'index' => 'search-linkedin-post', // index name
'_source' => 'public_linkedin_posts_new_text, public_linkedin_posts_new_poster_linkedin_url, public_linkedin_posts_new_reshared', // fields to return
'body' => [
'query' => [
'bool' => [
'should' => [
@atakde
atakde / filter.php
Created January 6, 2024 10:35
Elastic Filter Example
<?php
$searchResults = $searchEngine->search(
[
'index' => 'search-linkedin-post', // index name
'_source' => 'public_linkedin_posts_new_text, public_linkedin_posts_new_poster_linkedin_url, public_linkedin_posts_new_reshared', // fields to return
'body' => [
'query' => [
'bool' => [
'filter' => [
@atakde
atakde / boolQueryShould.php
Last active January 6, 2024 11:06
Bool Query Should Example
<?php
$searchResults = $searchEngine->search(
[
'index' => 'search-linkedin-post', // index name
'_source' => 'public_linkedin_posts_new_text, public_linkedin_posts_new_poster_linkedin_url', // fields to return
'body' => [
'query' => [
'bool' => [
'should' => [
@atakde
atakde / boolQuery.php
Created January 6, 2024 10:26
Elastic Bool Query PHP
<?php
$searchResults = $searchEngine->search(
[
'index' => 'search-linkedin-post', // index name
'_source' => 'public_linkedin_posts_new_text, public_linkedin_posts_new_poster_linkedin_url', // fields to return
'body' => [
'query' => [
'bool' => [
'must' => [
@atakde
atakde / test.php
Created January 6, 2024 10:10
Medium Elastic Example
<?php
require 'vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
use Atakan\ElasticEx\MySearchEngine;
$searchEngine = new MySearchEngine();
$searchResults = $searchEngine->search(