Skip to content

Instantly share code, notes, and snippets.

View taniarascia's full-sized avatar
💾

Tania Rascia taniarascia

💾
View GitHub Profile
@taniarascia
taniarascia / git-deploy.bash
Last active March 31, 2020 09:29
Track, commit, and push to git origin and development with bash script
#!/bin/bash
read -r -p 'Commit message: ' ${desc} # prompt user for commit message
git add . # track all files
git add -u # track all deleted files
git commit -m "$desc" # commit with message
git push origin master # push to origin
git push production master # push to development server
@taniarascia
taniarascia / fetch.js
Last active February 13, 2024 07:50
Fetch json
fetch('./js/data.json').then(response => {
return response.json();
}).then(data => {
console.log(data);
}).catch(err => {});
@taniarascia
taniarascia / memory-0.1.js
Last active April 22, 2024 04:44
Memory Game Tutorial
const cardsArray = [ /* ... */ ];
const game = document.getElementById('game');
const grid = document.createElement('section');
grid.setAttribute('class', 'grid');
game.appendChild(grid);
cardsArray.forEach(item => {
const card = document.createElement('div');
card.classList.add('card');
@taniarascia
taniarascia / triangle.css
Created February 6, 2018 04:09
Triangle
i {
border: solid black;
border-width: 0 3px 3px 0;
display: inline-block;
padding: 3px;
transform: rotate(45deg);
}
@taniarascia
taniarascia / php-pdo-mysql-crud.md
Created May 4, 2017 15:40 — forked from odan/php-pdo-mysql-crud.md
Basic CRUD operations with PDO and MySQL

Basic CRUD operations with PDO

CRUD = Create, Read, Update, Delete

Open a database connection

$host = '127.0.0.1';
$dbname = 'test';
$username = 'root';
//Forged Settings
function forged_settings_add_options(){
add_options_page( 'Forged Settings', 'Forged Settings', 'manage_options', 'forged-settings', 'forged_settings_page');
}
add_action( 'admin_menu', 'forged_settings_add_options');
//Create Forged Settings Submenu
function forged_settings_page(){ ?>
<div class = "wrap">
<h1>Forged Theme Settings</h1>
@taniarascia
taniarascia / osx_setup.md
Created November 2, 2016 18:06 — forked from andrewvaughan/osx_setup.md
Mac OSX Setup

Mac OSX Bootstrap

Upgrade to Mavericks

  1. Install Mavericks via the App Store.

Secure The Machine

@taniarascia
taniarascia / page.php
Created August 10, 2016 18:09
Displaying all the output from your custom meta box
<?php get_header(); ?>
<?php
$args = array(
'post_type' => 'your_post',
);
$your_loop = new WP_Query( $args ); if ( $your_loop->have_posts() ) : while ( $your_loop->have_posts() ) : $your_loop->the_post();
$meta = get_post_meta( $post->ID, 'your_fields', true ); ?>
@taniarascia
taniarascia / functions.php
Last active February 13, 2024 07:51
Inlcuding custom fields and uploads in a WordPress post
<?php
function create_post_your_post() {
register_post_type( 'your_post',
array(
'labels' => array(
'name' => __( 'Your Post' ),
),
'public' => true,
'hierarchical' => true,
@taniarascia
taniarascia / escape-html.php
Created June 7, 2016 00:47
Escape HTML in WordPress
<?php
// Escape HTML in <code> or <pre><code> tags.
function escapeHTML($arr) {
if (version_compare(PHP_VERSION, '5.2.3') >= 0) {
$output = htmlspecialchars($arr[2], ENT_NOQUOTES, get_bloginfo('charset'), false);
}
else {
$specialChars = array(