Skip to content

Instantly share code, notes, and snippets.

View insinfo's full-sized avatar

Isaque Neves insinfo

  • Prefeitura de Rio das Ostras
  • Rio de Janeiro - Brasil
View GitHub Profile
@insinfo
insinfo / php_substring_html.php
Created August 11, 2023 14:51 — forked from getmanzooronline/php_substring_html.php
PHP Substring without breaking words and HTML tags
<?php
/**
* Truncates text.
*
* Cuts a string to the length of $length and replaces the last characters
* with the ending if the text is longer than length.
*
* @param string $text String to truncate.
* @param integer $length Length of returned string, including ellipsis.
@insinfo
insinfo / statvfs-df.c
Last active November 29, 2023 23:14 — forked from vgerak/statvfs-df.c
Get disk usage with statvfs()
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/statvfs.h>
#include <sys/types.h>
struct fs_usage {
uintmax_t fsu_blocksize; /* Size of a block. */
uintmax_t fsu_blocks; /* Total blocks. */
uintmax_t fsu_bfree; /* Free blocks available to superuser. */
@insinfo
insinfo / g++ test
Created November 18, 2023 01:00 — forked from 13abylon/g++ test
// g++ test.cpp --std=c++11 -lpthread -O2
//#ifdef WIN32 <- stdafx breaks this ifdef...
//#include "stdafx.h"
//#endif
#include <iostream>
#include <atomic>
#include <thread>
#include <vector>
@insinfo
insinfo / php_apache_mysql_win10.md
Created December 21, 2023 19:05 — forked from m-antoni/php_apache_mysql_win10.md
How to Setup PHP 7.2, Apache and MySQL in Windows 10

How to Setup PHP 7.2, Apache and MySQL in Windows 10

  1. First is to download php 7 to this website https://windows.php.net/download/

    • download VC15 x86 or x64 Thread Safe
    • download x86 for 32bit and x64 for 64bit system
  2. Make a directory and save it to this path C:/php

  3. Go to https://www.apachelounge.com/download/ to download the Apache server

  • Download Apache 2.4.39 Win64 or Apache 2.4.39 Win32
@insinfo
insinfo / object-fit-cover-video.js
Created January 22, 2024 22:40 — forked from dmail/object-fit-cover-video.js
object-fit:cover polyfill on video element using canvas
// http://stackoverflow.com/questions/21961839/simulation-background-size-cover-in-canvas
function drawImageProp(ctx, img, x, y, w, h, offsetX, offsetY) {
if (arguments.length === 2) {
x = y = 0;
w = ctx.canvas.width;
h = ctx.canvas.height;
}
// default offset is center
offsetX = typeof offsetX === "number" ? offsetX : 0.5;