Skip to content

Instantly share code, notes, and snippets.

View manhtienpt's full-sized avatar

ManhTienpt manhtienpt

View GitHub Profile
@manhtienpt
manhtienpt / microgpt.py
Created February 24, 2026 03:14 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@manhtienpt
manhtienpt / VideoStream.php
Created July 31, 2018 18:11 — forked from ranacseruet/VideoStream.php
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
<?php
/**
* Escape all translations with
*/
__( ‘Some String’, ‘text-domain’ ); _e( ‘Some string’, ‘text-domain’ );.
/**
* When there is no HTML use:
*/
@manhtienpt
manhtienpt / gist:80f53493d2f5a541913a9aaeb4993c64
Created June 28, 2016 07:27 — forked from MindyPostoff/gist:a10148daa110119b262f
Change "Proceed to PayPal" Text on Checkout Button in WooCommerce
/* Change the "Proceed to PayPal" button text in the WooCommerce checkout screen
* Add this to your theme's functions.php file
*/
add_filter( 'gettext', 'custom_paypal_button_text', 20, 3 );
function custom_paypal_button_text( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Proceed to PayPal' :
$translated_text = __( 'NEW BUTTON TEXT', 'woocommerce' );
break;
}
@manhtienpt
manhtienpt / README.md
Created June 3, 2016 09:45 — forked from fnichol/README.md
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@manhtienpt
manhtienpt / Add to cart interaction.markdown
Created February 3, 2016 08:59
Add to cart interaction
@manhtienpt
manhtienpt / Product Detail Gallery Component.markdown
Created February 3, 2016 08:49
Product Detail Gallery Component
@manhtienpt
manhtienpt / Dynamic Design for the Web.markdown
Created January 8, 2016 06:31
Dynamic Design for the Web
@manhtienpt
manhtienpt / Offcanvas sidebar menu with a twist.markdown
Created December 26, 2015 06:27
Offcanvas sidebar menu with a twist

Offcanvas sidebar menu with a twist

Idea and inspiration: https://dribbble.com/shots/1719325-GIF-Sticker-App

Developed in Chrome, not tested elsewhere, not production ready.

Known issue: content overflow is cut when rotated. Tried different pure-CSS solutions and none worked for me. Will give credit for a non-JS solution.

Menu items will flow out of container given window height below roughly 700px. Solved by media queries, can't be bothered to implement it here.

@manhtienpt
manhtienpt / Product Animation.markdown
Created December 26, 2015 06:21
Product Animation