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 / 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));
 });
@jpalala
jpalala / input.js
Created June 2, 2022 11:20
write a csv stream with json2csv
const { createReadStream, createWriteStream } = require('fs');
const { AsyncParser } = require('json2csv');
const fields = ['field1', 'field2', 'field3'];
const opts = { fields };
const transformOpts = { highWaterMark: 8192 };
// Using the promise API
const input = createReadStream(inputPath, { encoding: 'utf8' });
@jpalala
jpalala / azure-pipelines.yml
Created May 19, 2022 05:46 — forked from zanechua/azure-pipelines.yml
Azure Pipeline + Laravel + MySQL + PHPUnit + Laravel Dusk
# PHP
# Test and package your PHP project.
# Add steps that run tests, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/php
pool:
vmImage: 'Ubuntu 16.04'
variables:
phpVersion: 7.2
@jpalala
jpalala / log_clicks.md
Created April 8, 2022 00:00
how to log clicks

Source from Log users click without slowing the website down

$(function(){
   $('div.join-link').click(function(){
       var data-url = $(this).attr('data-target-url');
       $.ajax({
           type: 'POST',
           url: 'http://yourdomain.com/log_clicks.php',
 success:function(){window.location.href= data-url;},
@jpalala
jpalala / some-randoms-stuff.md
Created April 7, 2022 16:25
an idea for a social network
@jpalala
jpalala / setup.sh
Created April 7, 2022 04:17
script setup for dotfile
#!/bin/bash
# Source: https://github.com/technicalpickles/pickled-vim/blob/master/script/setup
set -e
cd "$(dirname "$0")/.."
if [ "$(uname -s)" = "Darwin" ]; then
brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…"
brew bundle
}