Skip to content

Instantly share code, notes, and snippets.

View yumyo's full-sized avatar

Giulia Nicole Pernice yumyo

View GitHub Profile
@roachhd
roachhd / README.md
Last active November 19, 2020 14:56
Ode To Dan : Quick switch Themes with javascript

A simple clone of Dan Edens' blog with the day/night persistent toggle ❤️

<script>
// Toggle night theme
var d = document.documentElement,
    t = document.querySelectorAll(".js--toggle-lights")[0],
    m = localStorage.getItem("nightmode");

if(m == "true") {
@oilvier
oilvier / bookmark.js
Last active May 6, 2025 01:32
Javascript to add a bookmark - Cross Browser
/**
*
* Add to bookmark
* Several tests are necessary in order for this "simple" action to work in most of the browsers
*
*/
// First, we define the element where the "Add to bookmark" action will trigger
var triggerBookmark = $(".js-bookmark"); // It must be an `a` tag
@grappler
grappler / functions.php
Last active September 5, 2024 01:21
// add ie conditional html5 shim to header
<?php
// add ie conditional html5 shim to header
function _s_add_ie_html5_shim () {
echo '<!--[if lt IE 9]>';
echo '<script src="' . get_template_directory_uri() . '/js/html5.js"></script>';
echo '<![endif]-->';
}
add_action('wp_head', '_s_add_ie_html5_shim');
@nishantmodak
nishantmodak / nginx.conf.default
Last active May 7, 2025 07:58
Default Nginx Conf
#user nobody;
#Defines which Linux system user will own and run the Nginx server
worker_processes 1;
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores.
#error_log logs/error.log; #error_log logs/error.log notice;
#Specifies the file where server logs.
@sgnl
sgnl / add-upstream.md
Last active October 3, 2023 22:51
So you've forked a Repository and you want updates...

#tl;dr

setting up a branch to track a repo

pre: assuming you have forked a repo and cloned your fork to your computer

  1. git remote add [maintainer's name] [paste URL here]
  2. git fetch --all
  3. git branch --track [maintainer's name]_[branch] [remote name from step 1]/[branch you want to track] At this point you may watch to checkout to your newly create branch and issue a git pull command.
<?php
class Maera_Timber_Conditionals extends TimberCore {
public $comments_open;
public $has_tag;
public $has_term;
public $in_category;
public $is_404;
public $is_admin;
@lonekorean
lonekorean / gist:1b9a17bbf235a7557a0e
Created June 10, 2015 20:39
Checkbox trickery, ordering with flexbox
.items {
display: flex;
flex-direction: column;
}
.done {
order: 1;
}
input:checked + label {
@IceCreamYou
IceCreamYou / percentile.js
Last active November 17, 2022 01:54
Utility functions to calculate percentiles and percent ranks in a JavaScript array.
// Returns the value at a given percentile in a sorted numeric array.
// "Linear interpolation between closest ranks" method
function percentile(arr, p) {
if (arr.length === 0) return 0;
if (typeof p !== 'number') throw new TypeError('p must be a number');
if (p <= 0) return arr[0];
if (p >= 1) return arr[arr.length - 1];
var index = (arr.length - 1) * p,
lower = Math.floor(index),
@jtsternberg
jtsternberg / colliding.js
Last active August 12, 2024 17:52 — forked from JayWood/colliding.js
Detect if two elements are colliding/overlapping
/**
* Detects if two elements are colliding
*
* Credit goes to BC on Stack Overflow, cleaned up a little bit
*
* @link http://stackoverflow.com/questions/5419134/how-to-detect-if-two-divs-touch-with-jquery
* @param $div1
* @param $div2
* @returns {boolean}
*/
@lkwdwrd
lkwdwrd / Customfile
Created September 15, 2015 02:20
VVV Customfile for Hyper-V compatibility
# Hyper-V only overrides
config.vm.provider :hyperv do |v, override|
# Update memory and CPUs to match VVV config.
v.memory = 1024
v.cpus = 1
# Use a Hyper-V compatible base box
override.vm.box = "ericmann/trusty64
# Change all the folder to use SMB instead of Virtual Box shares