Skip to content

Instantly share code, notes, and snippets.

@TimBHowe
TimBHowe / gist:6765309
Created September 30, 2013 15:16
PHP function to truncate a string up to a number of characters while preserving whole words and HTML tags. Source from http://alanwhipple.com/2011/05/25/php-truncate-string-preserving-html-tags-words/
<?php
/**
* truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags
*
* @param string $text String to truncate.
* @param integer $length Length of returned string, including ellipsis.
* @param string $ending Ending to be appended to the trimmed string.
* @param boolean $exact If false, $text will not be cut mid-word
* @param boolean $considerHtml If true, HTML tags would be handled correctly
*
@gitaarik
gitaarik / git_submodules.md
Last active November 16, 2024 19:55
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
abandoned
able
absolute
adorable
adventurous
academic
acceptable
acclaimed
accomplished
accurate
@meain
meain / loading_messages.js
Last active November 18, 2024 12:25
Funny loading messages
export default [
"Reticulating splines...",
"Generating witty dialog...",
"Swapping time and space...",
"Spinning violently around the y-axis...",
"Tokenizing real life...",
"Bending the spoon...",
"Filtering morale...",
"Don't think of purple hippos...",
"We need a new fuse...",
@zthxxx
zthxxx / Activate Office 2019 for macOS VoL.md
Last active November 18, 2024 20:19
crack activate Office on mac with license file
@eduardoarandah
eduardoarandah / UploadController.php
Last active November 3, 2023 17:11
File upload with dropzone and alpine js
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
use Storage;
class UploadController extends Controller
Alpine.directive('typed', (el, { expression, modifiers }, { evaluateLater, effect, cleanup }) => {
const getStrings = evaluateLater(expression);
const modifierValue = (key, fallback) => {
if (-1 === modifiers.indexOf(key)) {
return fallback;
}
const value = modifiers[modifiers.indexOf(key) + 1];