Skip to content

Instantly share code, notes, and snippets.

View Yohn's full-sized avatar
🔥
Playing with Fire

JWB Yohn

🔥
Playing with Fire
View GitHub Profile
<?php
function emptyDirectory($dirname,$self_delete=false){
if(is_dir($dirname))
$dir_handle = opendir($dirname);
if(!$dir_handle)
return false;
while($file = readdir($dir_handle)){
if($file != "." && $file != ".."){
if (!is_dir($dirname."/".$file))
@unlink($dirname."/".$file);
@Yohn
Yohn / function.generateRandomString.php
Created January 9, 2023 05:01
Simple generate random string function in PHP with max length option and easy to change characters.
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
}
@Yohn
Yohn / gitpod.yml reference
Created September 24, 2022 21:09 — forked from ghuntley/gitpod.yml reference
Iterating on a reference Gitpod.yml that serves as a verbose 'documentation as code' which is intended to explain possibilities and how to configure them without folks needing to open a browser. Leave feedback on https://gist.github.com/ghuntley/1914fd5d15aec638d6dbb8d32d00f1e5 if you got any.
## Learn more about this file at 'https://www.gitpod.io/docs/references/gitpod-yml'
##
## This '.gitpod.yml' file when placed at the root of a project instructs
## Gitpod how to prepare & build the project, start development environments
## and configure continuous prebuilds. Prebuilds when enabled builds a project
## like a CI server so you can start coding right away - no more waiting for
## dependencies to download and builds to finish when reviewing pull-requests
## or hacking on something new.
##
## With Gitpod you can develop software from any device (even iPads) via
  • Codacy
  • Coveralls
  • Travis
  • Lean Board
  • Starhub
  • Code Dog Auto Merge
  • Greenkeeper
  • Dependabot preview
  • Hound
  • Imgbot
@Yohn
Yohn / SassMeister-input.scss
Created August 27, 2022 06:07 — forked from Snugug/SassMeister-input.scss
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.7)
// ----
$zoo: ("puma": black, "sea-slug": green, "egret": brown, "salamander": red);
@each $animal, $color in $zoo {
.#{$animal}-icon {
background-color: $color;
name: PDF to PNG
on:
push:
branches:
- kaspar
pull_request:
branches:
- kaspar
jobs:
@Yohn
Yohn / fastfix.js
Created December 12, 2012 11:35 — forked from justinbmeyer/fastfix.js
(function(){
var set = function(obj, prop, val){
Object.defineProperty(obj,prop,{
value : val
})
return val;
};
@Yohn
Yohn / README.markdown
Created September 17, 2012 08:31 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string