Skip to content

Instantly share code, notes, and snippets.

@AdnaneX
AdnaneX / elastic_search_query.md
Created October 5, 2023 19:19 — forked from amulyakashyap09/elastic_search_query.md
How to query in elastic-search

Terminologies

We will be using following information throughout this article:

  • index_name : customers
  • index_type : personal
  • customer will have name,age,gender,email,phone,address,city,state as fields in schema for now

INFO Queries

@AdnaneX
AdnaneX / rest-example.php
Created January 11, 2023 17:17 — forked from snez/rest-example.php
How to use Magento 2 REST API using the official Stripe module
<?php
function getAdminToken()
{
$url = 'https://example.com/rest/default/V1/integration/admin/token';
$data = [
"username" => "user",
"password" => "user_password"
];
$data_string = json_encode($data);
import 'dart:convert';
class Restaurant {
Restaurant({
required this.name,
required this.cuisine,
this.yearOpened,
required this.reviews,
});
final String name;
@AdnaneX
AdnaneX / README.md
Created August 11, 2022 04:18 — forked from Luzifer/README.md
Running docker-compose as a systemd service

Running docker-compose as a systemd service

Files

File Purpose
/etc/compose/docker-compose.yml Compose file describing what to deploy
/etc/systemd/system/docker-compose-reload.service Executing unit to trigger reload on docker-compose.service
/etc/systemd/system/docker-compose-reload.timer Timer unit to plan the reloads
/etc/systemd/system/docker-compose.service Service unit to start and manage docker compose
@AdnaneX
AdnaneX / docker-aliases.sh
Created July 28, 2022 00:46 — forked from jgrodziski/docker-aliases.sh
Useful Docker Aliases
############################################################################
# #
# ------- Useful Docker Aliases -------- #
# #
# # Installation : #
# copy/paste these lines into your .bashrc or .zshrc file or just #
# type the following in your current shell to try it out: #
# wget -O - https://gist.githubusercontent.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb/raw/d84ef1741c59e7ab07fb055a70df1830584c6c18/docker-aliases.sh | bash
# #
# # Usage: #
@AdnaneX
AdnaneX / tampermonkey.jquery.js
Created January 14, 2022 01:42 — forked from eristoddle/tampermonkey.jquery.js
How to get jQuery to work in Chrome Tampermonkey userscripts
// ==UserScript==
// @name Vortek Preload
// @namespace vortek
// @description Load variables
// @include http://localhost/vortek_php/*
// @version 1
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
var script = document.createElement("script");
@AdnaneX
AdnaneX / vue-nginx.conf
Created May 31, 2021 14:25 — forked from namdau/vue-nginx.conf
Nginx config for Vuejs project with an API upstream
server {
server_name default_server;
# This is for Let's Encrypt certification renewal
include /etc/nginx/snippets/letsencrypt.conf;
# Redirect to https
location / {
return 301 https://$server_name$request_uri;
}
}
@AdnaneX
AdnaneX / install-jetbrains-toolbox.sh
Created September 30, 2020 10:37 — forked from abn/install-jetbrains-toolbox.sh
Install JetBrains Toolbox App
#!/usr/bin/env bash
# Reference: https://github.com/nagygergo/jetbrains-toolbox-install/blob/master/jetbrains-toolbox.sh
# Note that we grep for linux here, if you are using this on mac/windows please see json output
TOOLBOX_URL=$(curl --silent 'https://data.services.jetbrains.com//products/releases?code=TBA&latest=true&type=release' \
-H 'Origin: https://www.jetbrains.com' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.8' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Referer: https://www.jetbrains.com/toolbox/download/' \
@AdnaneX
AdnaneX / time_ago_since_now.dart
Created August 10, 2020 21:47 — forked from DineshKachhot/time_ago_since_now.dart
Flutter Time ago calculator
static String timeAgoSinceDate(String dateString, {bool numericDates = true}) {
DateTime date = DateTime.parse(dateString);
final date2 = DateTime.now();
final difference = date2.difference(date);
if ((difference.inDays / 365).floor() >= 2) {
return '${(difference.inDays / 365).floor()} years ago';
} else if ((difference.inDays / 365).floor() >= 1) {
return (numericDates) ? '1 year ago' : 'Last year';
} else if ((difference.inDays / 30).floor() >= 2) {
@AdnaneX
AdnaneX / FlutterStack.dart
Created August 7, 2020 23:58 — forked from lvh1g15/FlutterStack.dart
Flutter Material Custom Card Stack View
class HousePickerView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new GradientAppBar('Houses',
new ListView(
children: <Widget>[
new HouseListTile(url: [
'https://statusandphoto.weebly.com/uploads/6/0/1/5/60158603/8347592_orig.png',
'http://globalmedicalco.com/photos/globalmedicalco/20/98181.jpg',
'https://allinonetricks.com/wp-content/uploads/2017/08/5-7.png'