Skip to content

Instantly share code, notes, and snippets.

@Sstobo
Sstobo / workflow.txt
Last active November 1, 2017 17:19
[workflow] #setup
###############
initialization
###############
create folder
git init
get git info from github
create files
create gitignore
commit files
@Sstobo
Sstobo / screen-reader-text.txt
Created October 26, 2017 18:59
[screen reader text hide] #a11y
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
}
@Sstobo
Sstobo / gulpfile.js
Created October 30, 2017 23:17
[gulpfile w /sass mininfy babrel ect Oct 29]
// LINKED NODES
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
browserSync = require('browser-sync').create(),
eslint = require("gulp-eslint"),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
prettyError = require('gulp-prettyerror'),
@Sstobo
Sstobo / webpack-inst.txt
Last active November 1, 2017 17:53
[webpack install] #setup
Set up a new project with Webpack:
Create a new folder for your project:
Remember to run npm init in your project’s root directory.
Remember to create a .gitignore file and add node_modules at the top
Create the following folders within:
src
build
Create the following files:
index.html (in project root)
@Sstobo
Sstobo / phptruthy.txt
Created November 7, 2017 17:38
[PHP truthy falsey] #php
$my_var = false;
if ( isset( $my_var ) ) {
echo "It's set!";
} else {
echo "It's not set.";
}
The empty() function checks if the variable is an empty string, 0, NULL, or false.
$my_var = false;
@Sstobo
Sstobo / phploop.txt
Created November 7, 2017 17:44
[PHP loops] #php
You may often see loops written in a slightly different way from what we've seen so far:
if ( $color == 'blue' ) {
echo '<p>The color is blue.</p>';
} elseif ( $color == 'red' ) {
echo '<p>The color is red.</p>';
} else {
echo '<p>The color is not blue or red.</p>';
}
<?php if ( $color == 'blue' ) :?>
@Sstobo
Sstobo / phpimpexp.txt
Created November 7, 2017 17:58
[PHP array implode explode] #php
To convert array items into a comma-separated string, use the implode() function:
$skills = array( 'html', 'css', 'js', 'php' );
$comma_separated = implode(',', $array);
echo $comma_separated; // output: html,css,js,php
You can also convert a string to an array using the explode() function:
$skills = 'html css js php';
$skills_array = explode( ' ', $skills );
print_r( $skills_array );
@Sstobo
Sstobo / wpsetup.txt
Created November 8, 2017 17:58
[wordpress install] #wp #setup
We can also install WP locally using MAMP:
Download WordPress
Unzip your download and move it to your htdocs folder (rename the unzipped folder if you like)
Go to phpMyAdmin (via MAMP) and create a new database
Rename wp-config-sample.php to wp-config.php and fill in your database name and MAMP credentials
Go to http://localhost:8888/YOUR-FOLDER/wp-admin/install.php and complete your install
name folder and name database same thing
@Sstobo
Sstobo / gist:7f69c255ee9fce951c3d294b80ab7935
Created November 8, 2017 19:37
[wordpress access] #wp #setup
To do that, go to the MAMP WebStart page and click on the Tools > phpMyAdmin in the menu.
@Sstobo
Sstobo / gist:495bce997393ca0367b8241d8db09335
Created November 8, 2017 19:37
[wordpress theme .css] #wp #css #setup
/*
Theme Name: RED Starter Theme
Theme URI: http://underscores.me/
Author: RED Academy
Author URI: http://www.redacademy.com/
Description: A WordPress start theme for RED Academy students.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/