Skip to content

Instantly share code, notes, and snippets.

View diendv96's full-sized avatar

diendv96 diendv96

View GitHub Profile
@diendv96
diendv96 / README.md
Created July 11, 2022 10:29
Find spreadsheetId from Google Sheet URL (https://go.dev/play/p/aMfoBAQU7cC)

Spreadsheet The primary object in Google Sheets that can contain multiple sheets, each with structured information contained in cells. A Spreadsheet resource represents every spreadsheet and has a unique spreadsheetId value, containing letters, numbers, hyphens, or underscores. You can find the spreadsheet ID in a Google Sheets URL:

https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0

@diendv96
diendv96 / nginx.conf.sample
Created January 29, 2019 04:40
NGINX CORS enable for Magento
...
add_header 'Access-Control-Allow-Origin' '$http_origin';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE, HEAD';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Origin,Content-Type,Accept,Authorization';
location / {
try_files $uri $uri/ /index.php$is_args$args;
if ($request_method = 'OPTIONS') {

FWIW: I didn't produce the content present here. I've just copy-pasted it from somewhere over the Internet, but I cannot remember exactly the original source. I was also not able to find the author's name, so I cannot give him/her the proper credit.


Effective Engineer - Notes

What's an Effective Engineer?

@diendv96
diendv96 / scraper.py
Created July 30, 2017 05:47
Nhận thông báo qua SMS khi web có news mới
import requests
from bs4 import BeautifulSoup
from pymongo import MongoClient
from twilio.rest import Client
import time
def format_message(post):
return "New post: " + post['title'] + "\n" + post['link']
@diendv96
diendv96 / README.md
Created March 24, 2017 13:18 — forked from hsablonniere/README.md
scrollIntoViewIfNeeded 4 everyone!!!

scrollIntoViewIfNeeded 4 everyone!!!

This gist provides a simple JavaScript implementation of the non-standard WebKit method scrollIntoViewIfNeeded that can be called on DOM elements.

Usage

Just use the code in index.js in your app or website. You can see usage in the test page test.html.

The parent element will only scroll if the element being called is out of the view. The boolean can force the element to be centered in the scrolling area.

@diendv96
diendv96 / System Design.md
Created April 25, 2016 01:45 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@diendv96
diendv96 / nginx.conf
Created October 31, 2015 03:39 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@diendv96
diendv96 / comments.php
Created October 20, 2015 08:52 — forked from abrudtkuhl/comments.php
WordPress comments.php for Responsive Facebook Comments
<div class="fb-comments"data-href="<?php the_permalink(); ?>" data-num-posts="2" mobile="false"></div>
<?php
/**
* Get download link of a Magento extension from MagentoConnect key
*
* Dependencies: Zend_Http_Client, Zend_Uri (Zend Framework)
*/
class Narno_Mage_Extension
{
protected $_key = null;