Skip to content

Instantly share code, notes, and snippets.

View elraghifary's full-sized avatar

Elra Ghifary elraghifary

View GitHub Profile
@elraghifary
elraghifary / index.vue
Created November 13, 2023 04:47
OpenTelemetry Nuxt
<template>
<div>
<kid-organisms-voucher />
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
import { initTracer, createSpan } from '~/plugins/methods/opentelemetry'
@elraghifary
elraghifary / opentelemetry.ts
Created November 13, 2023 04:43
OpenTelemetry Nuxt
import { trace, Span, Tracer } from '@opentelemetry/api'
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web'
import { Resource } from '@opentelemetry/resources'
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base'
import { ZoneContextManager } from '@opentelemetry/context-zone'
import { B3Propagator } from '@opentelemetry/propagator-b3'
import { registerInstrumentations } from '@opentelemetry/instrumentation'
import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web'
-- Write only the SQL statement that solves the problem and nothing else.
SELECT e.name
FROM employees e
LEFT JOIN employees e2 ON e2.managerId = e.id
WHERE e2.managerId IS NULL
-- Write only the SQL statement that solves the problem and nothing else.
SELECT COUNT(*) AS number
FROM students
WHERE firstName = 'John'
<?php
class Pipeline
{
public static function make_pipeline(...$funcs)
{
return function($arg) use ($funcs)
{
// calling each make_pipeline function
foreach ($funcs as $func) {
// check if there is result from function
<?php
class Palindrome
{
public static function isPalindrome($word)
{
// ignore character case
$word = strtolower($word);
// we can use strrev from php to reverse a string
if (strrev($word) == $word) {
@elraghifary
elraghifary / readme.php
Created July 23, 2017 16:49
Paginate data from MySQL in reverse order
<?php
// database connection
$dbHost = 'localhost';
$dbUsername = 'root';
$dbPassword = 'secret';
$dbName = 'database_name';
$conn = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
@elraghifary
elraghifary / readme.php
Last active July 23, 2017 16:45
Paginate data from MySQL
<?php
// database connection
$dbHost = 'localhost';
$dbUsername = 'root';
$dbPassword = 'secret';
$dbName = 'database_name';
$conn = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
if ($conn->connect_error) {
"winter_2017_battle_pass_item_recycling"
{
"Warden of the Wyrmforge Shard" "1"
"Hunter's Glory" "1"
"Nomad of the Burning Decree" "1"
"Imperious Command" "1"
"Adage of the Smoldering Sage" "1"
"Jiang Shi's Revenge" "1"
"Barding of the Soul Keeper" "1"
"Bearer of the Arkturan Talon" "1"
"recycling_new_bloom_2017_wheel_old_treasures"
{
"Winter 2017 Treasure I" "1"
"Winter 2016 Treasure IV" "1"
"Winter 2016 Treasure III" "1"
"Winter 2016 Treasure II" "1"
"Winter 2016 Treasure I" "1"
"Welcoming Chest" "1"
"Warhammer: Treasure of the Old World" "1"
"Trust of the Benefactor 2016" "1"