Skip to content

Instantly share code, notes, and snippets.

View zorca's full-sized avatar
✴️
Working from a faraway star

Zorca Orcinus zorca

✴️
Working from a faraway star
View GitHub Profile
@zorca
zorca / parse_version_numbers.php
Created March 14, 2019 10:00 — forked from stevenrombauts/parse_version_numbers.php
Parse version numbers into major/minor/patch values
<?php
$versions = array('1.0 RC1', '1.0 RC2', '1.0 RC3', '1.0 RC4', '1.0 RC5', '1.0 RC6', '1.5.0', '1.5.1', '1.5.10', '1.5.11', '1.5.12', '1.5.13', '1.5.14', '1.5.15', '1.5.2', '1.5.3', '1.5.4', '1.5.5', '1.5.6', '1.5.7', '1.5.8', '1.5.9', '1.6.0', '1.6.1', '1.6.2', '1.6.3', '1.6.4', '1.6.5', '1.6.6', '1.6.7', '5.3.5-1ubuntu7.11', '2.14 RC1', '3.12RC5');
foreach($versions as $version)
{
$result = preg_match("/^(\d+)\.(\d+)[\. \-]?([a-z0-9\-\.]+)$/i", $version, $matches);
if($result)
{
$major = (int) $matches[1];
@zorca
zorca / wordpress.sh
Created March 12, 2019 16:52 — forked from durvalrafael/wordpress.sh
Wordpress permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
###########################################
# Constants, set and forget
###########################################
# temp storage for the wordpress tarball
TMP_STORAGE=/home/USER/wptemp
# web root for the wordpress site
WWWROOT=/var/www
# Privileged db use/pwd for creating database and granting rights
@zorca
zorca / bootstrap-4-sass-mixins-cheat-sheet.scss
Created February 6, 2019 23:19 — forked from anschaef/bootstrap-4-sass-mixins-cheat-sheet.scss
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// Updated to Bootstrap v4.1.x
// @author https://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/v4-dev/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;
@zorca
zorca / remove-woocommerce-styles-scripts.php
Created January 18, 2019 09:55 — forked from gregrickaby/remove-woocommerce-styles-scripts.php
Remove WooCommerce styles and scripts.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Manage WooCommerce styles and scripts.
*/
function grd_woocommerce_script_cleaner() {
// Remove the generator tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@zorca
zorca / youtube_id_regex.php
Created December 8, 2018 13:50 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@zorca
zorca / simplepie_example.php
Created October 25, 2018 09:15 — forked from franz-josef-kaiser/simplepie_example.php
SimplePie - example method to list what information we can retrieve about a feed as a whole and for single items when looping through
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (WCM) RSS Importer
*/
add_action( 'plugins_loaded', array( 'WCMRSSImporterBootstrap', 'init' ) );
class WCMRSSImporterBootstrap
{
protected static $instance = null;
@zorca
zorca / Gitlabserver.md
Created August 26, 2018 06:09 — forked from HendrikPetertje/Gitlabserver.md
Create your own GitLab server

#Setup Your own Gitlab server from the on-click install image ##Create the server image Login to Digital Ocean and create click the "New Droplet" button. In the page fill out the details for your new droplet. The best thing is to choose $10.- server since this server has the necessary RAM of 1GB. You can however choose for the $5.- server to but this will require setting up Swap once your server is deployed. Now when selecting your image choose "Application" and select GitLab. Create the droplet and wait for your ssh keys to come in.

##Modify the Ubuntu environment. ###Change login details Log in to your root account using your version of the command below

@zorca
zorca / bootstrap-4-sass-mixins-cheat-sheet.scss
Created August 17, 2018 16:18
Bootstrap 4 Sass Mixins [Cheat sheet with examples] #BS4
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// @author http://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/v4-dev/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;
86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace