Skip to content

Instantly share code, notes, and snippets.

View ScarletPonytail's full-sized avatar

ScarletPonytail ScarletPonytail

View GitHub Profile
@ScarletPonytail
ScarletPonytail / script.js
Created April 5, 2018 15:10
JS / JQuery - Query array inline
function suggestUserLocation() {
if ( getCookie( 'closestLocation' ) !== '' ) {
var closestLocation = jQuery.parseJSON( getCookie( 'closestLocation' ) );
var theCountries = [
'Cayman Islands',
'Falkland Islands',
'Philippines',
'UAE',
'United Kingdom',
'United States'
@ScarletPonytail
ScarletPonytail / script.js
Created April 5, 2018 15:10
JS / JQuery - Query array inline
function suggestUserLocation() {
if ( getCookie( 'closestLocation' ) !== '' ) {
var closestLocation = jQuery.parseJSON( getCookie( 'closestLocation' ) );
var theCountries = [
'Cayman Islands',
'Falkland Islands',
'Philippines',
'UAE',
'United Kingdom',
'United States'
@ScarletPonytail
ScarletPonytail / site.js
Last active May 10, 2019 13:03
JS and jQuery - Starter file
(function ($, Drupal) {
$('body').addClass('loaded');
$('footer').addClass('footer');
})(jQuery, Drupal);
@ScarletPonytail
ScarletPonytail / _variables.scss
Last active March 20, 2018 11:55
Sass - Variables
// Colours
$primary: #80CBC4;
$secondary: #663399;
$alt-01: #EF5350;
$alt-02: #81C784;
$black: #000000;
$white: #ffffff;
@ScarletPonytail
ScarletPonytail / config.rb
Created March 20, 2018 11:50
Sass - config.rb
require 'compass/import-once/activate'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "/"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
@ScarletPonytail
ScarletPonytail / style.css
Created March 16, 2018 10:40
CSS - Calc function
width: calc(100% - 100px);
@ScarletPonytail
ScarletPonytail / menu.php
Created March 14, 2018 11:46
Drupal - If user logged in
<ul class="menu">
<?php
if (user_is_logged_in()) {
echo "Logged In";
echo '<li class="last leaf"><a href="/drupal-playground-7/user/logout" class="log-out">Log out</a></li>';
}
else {
echo "Not logged in";
echo '<li class="last leaf"><a href="/drupal-playground-7/user" class="log-in">Log in</a></li>';
}
@ScarletPonytail
ScarletPonytail / import.php
Created February 27, 2018 16:43
PHP - Import .csv to database
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$mysqli = new mysqli("localhost", "root", "root", "filmDB");
// Check connection
if($mysqli === false){
die("ERROR: Could not connect. " . $mysqli->connect_error);
}
@ScarletPonytail
ScarletPonytail / style.css
Created February 6, 2018 16:41
CSS - Transition
input[type=submit] {
min-width: 150px;
border-radius: 25px;
background-color: #b10205;
color: #ffffff;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
@ScarletPonytail
ScarletPonytail / file.php
Created February 5, 2018 15:44
Drupal - If wrapper
<?php if ($logo): ?>
<a href="<?php print $front_page; ?>" title="<?php print $site_name; ?>" rel="home" id="logo">
<img src="<?php print $logo; ?>" alt="<?php print $site_name; ?>"/>
</a>
<?php endif; ?>