Skip to content

Instantly share code, notes, and snippets.

View jpalala's full-sized avatar
🎯
Focusing

Joe Palala jpalala

🎯
Focusing
View GitHub Profile
@jpalala
jpalala / laravel-5-4-php-ext-requirements.md
Last active October 26, 2022 04:53
Laravel 5.3 or 5.4 PHP modules requireed for Ubuntu and Centos

Laravel docs says the following is needed

  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Many packages need curl, so I suggest adding php-curl and uploading and manipulating images require the gd library, php-gd

@jpalala
jpalala / slug-url-gen.php
Last active September 26, 2022 05:32 — forked from anonymous/gist:2912227
Slug URL generator for seo (removes spaces hyphens, and other characters)
<?php
function slugify($str) {
$search = array('Ș', 'Ț', 'ş', 'ţ', 'Ş', 'Ţ', 'ș', 'ț', 'î', 'â', 'ă', 'Î', 'Â', 'Ă', 'ë', 'Ë');
$replace = array('s', 't', 's', 't', 's', 't', 's', 't', 'i', 'a', 'a', 'i', 'a', 'a', 'e', 'E');
$str = str_ireplace($search, $replace, strtolower(trim($str)));
$str = preg_replace('/[^\w\d\-\ ]/', '', $str);
$str = str_replace(' ', '-', $str);
return preg_replace('/\-{2,}', '-', $str);
}
@jpalala
jpalala / nginx-php-fpm-mysql-and-phpmyadmin-on-mavericks.md
Last active September 9, 2022 14:52
How to get nginx php-fpm on your mac machine
@jpalala
jpalala / blah.js
Created July 1, 2022 05:48
get-relative-date blah blah blah
...require('moment') library
if ( isRelative ) {
moment(dueAt).diff(moment(Date.now()), 'days')
}
@jpalala
jpalala / package.json
Created June 30, 2022 13:52 — forked from defenestrator/package.json
Laravel Tailwind and Svelte 3: simple configuration.
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
@jpalala
jpalala / App.svelte
Created June 29, 2022 10:39
Svelte Slides increment POC
<script>
/* https://svelte.dev/repl/20f592923f584d6e9399392d4864e55a?version=3.48.0 */
import NextPage from './NextPage.svelte';
import { pageNum } from './stores.js';
let page;
let pageNumber;
let slides = ["<b>i</b>", "<b>love</b>", "<b>svelte</b>"];
@jpalala
jpalala / get_github_access_token.php
Created June 18, 2022 03:11
get github access token
<?php
$ENV['GITHUB_CLIENT_SECRET' => 'YOUR_CLIENT_SECRET', 'GITHUB_CLIENT_ID' => 'YOUR_CLIENT_ID'];
if (!function_exists('dd')) {
function dd()
{
echo '<pre>';
array_map(function($x) {var_dump($x);}, func_get_args());
die;
}
@jpalala
jpalala / README.markdown
Last active June 15, 2022 06:05
how to deploy frontend js app to resources views and include it
@jpalala
jpalala / how_to_clone_in_javascript.markdown
Created June 7, 2022 03:27
better object cloning in javascript

A more complete solution relies on ECMAScript 5 and uses definition instead of assignment:

  function update(target) {
        var sources = [].slice.call(arguments, 1);
        sources.forEach(function (source) {
            Object.getOwnPropertyNames(source).forEach(function(propName) {
                Object.defineProperty(target, propName,
                    Object.getOwnPropertyDescriptor(source, propName));
 });