Skip to content

Instantly share code, notes, and snippets.

View davidglezz's full-sized avatar
😃
Happy

David Gonzalez davidglezz

😃
Happy
View GitHub Profile
@sandeep1995
sandeep1995 / index.html
Last active April 2, 2019 04:14
Convert Callbacks to Promise to Async/Await
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style media="screen">
html,body{
font-family: monospace;
if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) {
//is IE 11 or below
}
@SebSept
SebSept / cron.php
Last active March 15, 2020 10:40 — forked from Shagshag/cron.php
<?php
class BackupDatabaseCronModuleFrontController extends ModuleFrontController
{
public function init()
{
try {
$this->checkAccess();
$this->module->cron();
header( "backup ok", true ,200 );
//Uses the https://github.com/github-tools/github library under the hood and exposes it as `gh` property
function GithubAPI(auth) {
let repo;
let filesToCommit = [];
let currentBranch = {};
let newCommit = {};
//the underlying library for making requests
let gh = new GitHub(auth);
@qerub
qerub / httpsExchange.ts
Created December 18, 2016 00:24
[TypeScript] Dependency-free Promise-based Node.js HTTP client
// Based on https://www.tomas-dvorak.cz/posts/nodejs-request-without-dependencies/
import * as https from "https";
async function httpsExchange(requestOptions: https.RequestOptions): Promise<string> {
return new Promise<string>((resolve, reject) => {
const request = https.request(requestOptions, (response) => {
if (response.statusCode < 200 || response.statusCode > 299) {
reject(new Error("Non-2xx status code: " + response.statusCode));
}

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@julienbourdeau
julienbourdeau / clean-prestashop-db.sql
Last active March 13, 2025 17:41
Clean PrestaShop database - Drop old and unless data
# Delete all logs
TRUNCATE ps_log;
# Delete old connection data (only used for stats)
# change 2016-02-01 00:00:00 according to you needs
DELETE c, cs
FROM ps_connections c
LEFT JOIN ps_connections_source cs ON (c.id_connections = cs.id_connections)
WHERE c.date_add < '2016-02-01 00:00:00';
@inexorabletash
inexorabletash / @ IndexedDB Full Text Search (Proof of Concept).md
Last active September 8, 2024 10:28
IndexedDB Full Text Search (Proof of Concept)

This demonstrates the implementation of full text search for documents in Indexed DB.

  • Word-breaking and stemming is used to create a list of terms for each document.
  • Document records are annotated with the list of terms when added to the database.
  • A multi-entry index on the list of terms is populated.
  • A query is similarly processed into a list of terms.
  • A join over the terms is implemented using multiple cursors on the index.

The necessity of annotating records with the word list to populate the index is a limitation of the current Indexed DB API. A feature request to support custom

/*
* Sorting Algorithms in C
* @sandeepemon
*/
#include<stdio.h>
#include<stdlib.h>
#define max 20
/*
* Printing the Array
*/
<?php
/**
* check sendtoafriend module vulnerability
*
* run it in terminal
*
* @link https://blog.seb7.fr/a/faille-sécurité-prestashop-module-envoyer-a-un-ami
* @author seb7.fr
*/