Skip to content

Instantly share code, notes, and snippets.

View abaicus's full-sized avatar

Andrei Băicuș abaicus

View GitHub Profile
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@abaicus
abaicus / bootstrap-check.php
Created March 31, 2016 08:22
Function to check if bootstrap is already included in the active theme. If it is not, it includes it.
<?php
/* CHECK FOR BOOTSTRAP (or other scripts)
There is no foolproof way to do this check. For this to work, I've assumed that the handles or at least the file names
of the enqueued scripts contain the string we need to check for.
*/
function check_dependencies() {
# How to install a new WordPress site from scratch using WP-CLI.
# We are going to assume that you have installed WP-CLI with all of the needed dependencies (composer, mysql, php) and added them to the global system/user path.
# Commands that you need to use in the CLI are marked with a ">" at the start of the row (you don't need to add that to the command).
# Create a new empty directory in your /www path. You can do that from the CLI directly. We are going to do a local install using WAMP software stack.
# Either go to the /www directory through explorer and create a new folder or use the following command in the CLI (you have to change your current directory to '/wamp/www' first).
> mkdir wordpress
sass --watch sass:css --style compressed --sourcemap=none
#Styles
:nested
:compact
:expanded
:compressed
@abaicus
abaicus / rebase-merge.bat
Created July 14, 2016 10:52
Rebase and Merge Conflict
git remote add upstream https://github.com/owner/repo.git
git fetch upstream
git rebase upstream/development
/* Solve conflicts */
git add conflicted-files.extension
@abaicus
abaicus / access_wamp.md
Last active July 27, 2016 14:23
Access your WAMP server from the LAN

What you need:

  • WP-CLI
  • WAMP
  • A WordPress instance
  • Notepad++ or any other text editor

Open a Command Prompt window and write the following command:

ipconfig all

/**
* My Account
*/
.woocommerce-account .woocommerce-MyAccount-navigation {
width: 20%;
}
.woocommerce-account .woocommerce-MyAccount-content {
display: inline-block;
@abaicus
abaicus / wp.bat
Created September 15, 2016 11:10
@ECHO OFF
php "c:/Environment/wp-cli/wp-cli.phar" %*
@abaicus
abaicus / instance.bat
Created January 2, 2017 10:49
Creates a named wp-instance, installs woocommerce and deletes standard plugins.
@echo off
set /p wpInstance= Local WordPress instance name: & echo.
set dbName=%wpInstance%
set dbUser=root
set dbPass=
rem change this if you want to personalize installs.
set user=andrei
set pass=andrei
@abaicus
abaicus / clickoutside.js
Created March 22, 2017 13:03
Hide on click outside
$(document).mouseup(function (e)
{
var container = $("YOUR CONTAINER SELECTOR");
if (!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.hide();
}
});