Skip to content

Instantly share code, notes, and snippets.

View mediabeastnz's full-sized avatar
💭

Myles mediabeastnz

💭
View GitHub Profile
@mediabeastnz
mediabeastnz / screen.tsx
Created April 11, 2024 02:18
Tailwind Screen size widget
"use client";
import React from 'react';
const ScreenSize = () => {
const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });
React.useEffect(() => {
function updateDimensions() {
setDimensions({
@mediabeastnz
mediabeastnz / .hyper.js
Created November 14, 2019 23:41
Hyper js configuration
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@mediabeastnz
mediabeastnz / 0_reuse_code.js
Created April 20, 2017 23:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mediabeastnz
mediabeastnz / gulp.md
Created November 24, 2016 21:04
From Bower to Gulp

Moving from Bower to Gulp

For a while now we have used Bower to manage frontend dependencies. We'd use bower to install dependencies into a folder called thirdparty. Although there was nothing wrong with this approach it did mean we were limited to what Bower itself could do...

Introducing... Gulp

Gulp is a tool to automate your build process. It has a heap of features but to start with we'll keep it simple.

The new approach requires a couple more tools to use along side Gulp including:

@mediabeastnz
mediabeastnz / silverstripe-prev-next.php
Last active March 11, 2021 13:07
SilverStripe Prev / Next Controls
public function PrevNextPage($Mode = 'next') {
if($Mode == 'next'){
return SiteTree::get()->filter(array("ParentID" => $this->ParentID, "Sort:GreaterThan" => $this->Sort))->sort("Sort ASC")->limit(1)->first();
}
elseif($Mode == 'prev'){
return SiteTree::get()->filter(array("ParentID" => $this->ParentID, "Sort:LessThan" => $this->Sort))->sort("Sort DESC")->limit(1)->first();
}
else{
return false;
@mediabeastnz
mediabeastnz / Staging&ProductionUsingGit
Last active December 1, 2022 14:47
Staging and Production Server using Git.
If you are running a large website where you will need to test new features on a seperate url before pushing them live then the following instructions are for you ;)
For this example imagine your url is apple.com and you want a development/staging site on a subdomain which is dev.apple.com
#Setup#
1. First thing you'll want to do is go ahead and create your website in plesk and add the subdomain dev.apple.com at the same time.
2. ssh into the server e.g. $ ssh username@ipaddress
3. Once logged in cd into the private directory (this will be where all git repos are stored) e.g. $ cd ~/private
4. Create the main repo e.g. $ git init --bare apple.git
5. Now to clone this new repo on your local machine. $ git clone ssh://username@ipaddres/~/private/apple.com
@mediabeastnz
mediabeastnz / terminal-aliases.sh
Last active December 10, 2016 16:53
Terminal functions and aliases.
## You can add these to your ./Users/User/.bash_profile so they can be called while in terminal. ##
## Aliases ##
alias wget="curl -O"
alias hosts='sudo nano /private/etc/hosts'
alias mamp='sudo /Applications/MAMP/bin/apache2/bin/apachectl restart'
alias g='git'
alias gall='git add --all'