Skip to content

Instantly share code, notes, and snippets.

View Luciaisacomputer's full-sized avatar
💭
In yer source code checking yer accessibilities

Lucia Adams Luciaisacomputer

💭
In yer source code checking yer accessibilities
View GitHub Profile
@Luciaisacomputer
Luciaisacomputer / package.json
Created April 8, 2018 19:27
Use Sass Quickly
{
"name": "SOME_NAME_HERE",
"version": "1.0.0",
"description": "",
"scripts": {
"css": "node-sass --output-style compressed --include-path scss src/scss/index.scss style.css",
"watch": "nodemon -e scss -x \"npm run css\""
},
"repository": {
"type": "git",
@Luciaisacomputer
Luciaisacomputer / button.js
Created January 2, 2018 19:37
Using a custom component in Gutenberg
const Button = require('../../../styleguide/components/Button/Button.jsx');
const { __ } = wp.i18n;
const { registerBlockType } = wp.blocks;
const Editable = wp.blocks.Editable;
const blockStyle = {
backgroundColor: '#900',
color: '#fff',
padding: '20px',
};

Staying Afloat: Keeping up with so much to learn

The JavaScript ecosystem is very large and still growing at an alarming pace. There is so much to learn it can seem like an endless race with a moving finish line. By the time you master one tool, another one comes out. Keeping up with everything can be a daunting task, and it is something that we all struggle with at one point or another. Fear not, there are many ways to stay up to date while developing deeper skills in the tools you already use. All it takes is structuring your learning in a way that yields maximum results without having to put in a lot of effort.

Know how you learn

Everybody has a unique learning style based on the types of learning that work best for us. These are placed into several primary categories including visual, auditory, reader/writer, and kinesthetic. Some people learn better in social settings while others tend to do better on their own. It's important to first understand exactly what style is the most effective for yo

@Luciaisacomputer
Luciaisacomputer / testform.js
Created December 20, 2016 19:06
Test FormData Easily
var xhr = new XMLHttpRequest;
xhr.open('POST', '/', true);
xhr.send(data);
@Luciaisacomputer
Luciaisacomputer / openVSCfromTerminal
Created December 6, 2016 20:18
Open Visual Studio Code From Terminal
#Just copy this into your preferred terminal
function code {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
local argPath="$1"
[[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
open -a "Visual Studio Code" "$argPath"
fi
@Luciaisacomputer
Luciaisacomputer / makeFILESsuckless.php
Created April 26, 2016 20:03
This helps make the $_FILES global array less clunky and easier to iterate over
<?php
function reArrayFiles(&$file_post) {
$file_ary = array();
$file_count = count($file_post['name']);
$file_keys = array_keys($file_post);
for ($i=0; $i<$file_count; $i++) {
foreach ($file_keys as $key) {
@Luciaisacomputer
Luciaisacomputer / get-post-keys.php
Created April 20, 2016 20:51
Get all post keys in one go!
<?php
foreach ($_POST as $key => $value)
echo htmlspecialchars('$_POST[\''.$key.'\']').'<br>';
?>
<IfModule mod_rewrite.c>
  RewriteEngine on

  # Attempt to load files from production if
  # they're not in our local version
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule wp-content/uploads/(.*) \
 http://{PROD}/wp-content/uploads/$1 [NC,L]

Array
(
    [0] => Array
        (
            [event_name] => Anotha Event
            [event_times] => Array
                (
                    [0] => Array
@Luciaisacomputer
Luciaisacomputer / phone-number-regex.txt
Created February 26, 2016 17:54
Regex for *most* phone numbers
\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|
2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|
4[987654310]|3[9643210]|2[70]|7|1)
\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*(\d{1,2})$