Skip to content

Instantly share code, notes, and snippets.

@snez
snez / rest-example.php
Last active January 11, 2023 17:18
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);
@amulyakashyap09
amulyakashyap09 / elastic_search_query.md
Last active March 14, 2024 10:57
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

@DineshKachhot
DineshKachhot / time_ago_since_now.dart
Created March 1, 2019 06:08
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) {
@tripflex
tripflex / DialogLoader.vue
Last active October 11, 2021 18:26
Vuetify Dialog Loader Component (with SnackBar) component that can be used locally or globally ( https://github.com/tripflex/VuetifyDialogLoader )
<template>
<div>
<!-- Using hide-overlay below allows for clicking while progress showing-->
<v-dialog
v-model="dialog"
persistent
:width="options.width"
v-bind:style="{ zIndex: options.zIndex }"
>
<v-card
@erdincay
erdincay / sugh.sh
Last active March 14, 2024 21:00
su GitHub (downloading all repositories from a given user)
#!/bin/bash
if [ -z "$1" ]; then
echo "waiting for the following arguments: username + max-page-number"
exit 1
else
name=$1
fi
if [ -z "$2" ]; then
@abn
abn / install-jetbrains-toolbox.sh
Last active December 1, 2023 14:00
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/' \
@lvh1g15
lvh1g15 / FlutterStack.dart
Last active August 7, 2020 23:58
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'
@6d61726b760a
6d61726b760a / mysql_repl_check.sh
Last active May 1, 2019 13:42 — forked from gchaix/mysql_repl_check.sh
mysql replication check script
#!/bin/bash
#--- Configurables ------------------------------------------
# replication delay threshold
TH_SECONDS_BEHIND=5
# notifcation email (if blank, no email will be sent)
EMAIL_ADDR=""
#------------------------------------------------------------
[Desktop Entry]
Version=1.0
Type=Application
Name=PhpStorm
Icon=/home/themoroccan09/programs/phpstorm/bin/phpstorm.png
Exec="/home/themoroccan09/programs/phpstorm/bin/phpstorm.sh" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-phpstorm
@eolant
eolant / Confirm.vue
Last active March 23, 2024 08:48
Vuetify Confirm Dialog component that can be used locally or globally
<template>
<v-dialog v-model="dialog" :max-width="options.width" :style="{ zIndex: options.zIndex }" @keydown.esc="cancel">
<v-card>
<v-toolbar dark :color="options.color" dense flat>
<v-toolbar-title class="white--text">{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text v-show="!!message" class="pa-4">{{ message }}</v-card-text>
<v-card-actions class="pt-0">
<v-spacer></v-spacer>
<v-btn color="primary darken-1" text @click.native="agree">Yes</v-btn>