Skip to content

Instantly share code, notes, and snippets.

View samuel-fonseca's full-sized avatar

sam samuel-fonseca

View GitHub Profile
@samuel-fonseca
samuel-fonseca / gist:ba8f738a8e2e3333fed2e9181a4e0eba
Created August 20, 2020 01:45 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@samuel-fonseca
samuel-fonseca / Hyper-V-Enabler.bat
Created August 12, 2020 00:38
Enable Hyper-V & Containers for Win10 Home - [Detailed Guide](https://itnext.io/install-docker-on-windows-10-home-d8e621997c1d)
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
pause
param([string] $Path, [switch] $Recurse, [int] $Depth, [switch] $Force, [string] $Exclude, [switch] $Help)
if ($Help) {
Write-Output "This script is meant to delete all macOS dot files which serve no purpose on Windows."
Write-Output "When copying a large number of files, simply copy them onto the Windows machine, then run this script"
Write-Output "./removeMacOSDotFiles.ps1
[[-Path] <string>]
[[-Depth] <int>]
[-Recurse]
[-Force]
[
{
"name": "Alabama",
"abbreviation": "AL"
},
{
"name": "Alaska",
"abbreviation": "AK"
},
{
// source: https://stackoverflow.com/questions/2499567/how-to-make-a-json-call-to-a-url/2499647#2499647
function getJSONP(url, success) {
var ud = '_' + new Date,
script = document.createElement('script'),
head = document.getElementsByTagName('head')[0]
|| document.documentElement;
window[ud] = function(data) {
head.removeChild(script);
success && success(data);
@samuel-fonseca
samuel-fonseca / UploadDropzoneFile.php
Last active February 5, 2018 19:12
A simple script to process file uploads from Dropzone.js extension. Just call the function `uploadFile()` and add the desired params.
<?php
/**
* @var $file is an array with file data
* @var $targetDir string with path to directory
* @var $maxFileSize int with max Byte size
* @var $_allowedFileTypes a comma separated string with all the allowed extensions
*/
function uploadFile(array $file, $targetDir, $maxFileSize = 100000, $_allowedFileTypes = '(jpg)')
{
// create var from array
{
"alphabet": [
{
"alpha": {
"low": "α",
"cap": "Α"
},
"beta": {
"low": "β",
"cap": "Β"
<?php
# I create a private function because it's used within my class, I only call it from the class itself
private function parseErrorString( $string )
{
// create delimiters here
$delimiters = array('-', "\r\n", "\n", "\r", "chr(13)");
// start by replacing the $delimiters
$ready = str_replace( $delimiters, $delimiters[0], $string );
// create new list() item:
<?php
/**
* Get content from the database
*
* @param $fields an array with what columns to pull
* @param $table which table to query
*
* @return $content with the table content
* @return $message with either an error or success message
*/
@samuel-fonseca
samuel-fonseca / dynamic_html_PHPMailer.php
Last active June 7, 2021 09:37
A dynamic method to create HTML Emails and send them using PHPMailer XOAUTH2 with Gmail. This project is in no shape or form part of the PHPMailer project; I am simply using PHPMailer to send the emails because of their great project.
<?php
/**
* Generate dynamic HTML emails
*
* @package Dynamic HTML PHPMailer builder
* @author Samuel Fonseca <[email protected]>
* @description Setup dynamic HTML emails using PHPMailer
*/
/**