Skip to content

Instantly share code, notes, and snippets.

View cosmomathieu's full-sized avatar
🎯
Focusing

Cosmo Mathieu cosmomathieu

🎯
Focusing
View GitHub Profile
@metacurb
metacurb / GenerateSprite.jsx
Last active March 21, 2019 18:05
A Photoshop script to make the sprite-creation process a little more manageable.
// Sprite Generator (Tested on CS5)
// Written by Beau August 2017.
// DESCRIPTION:
// This script will take the width and height of your document, and generate
// a sprite based on the number of images inside the document. The images
// will be automatically aligned. An alignment layer will be placed behind
// each image in the sprite, in case one needs to be changed, modified or
// removed.
@domsie
domsie / is_url_reachable.php
Created February 16, 2017 13:08
Check if the given URL is reachable with php && curl
<?php
/**
* Check if the URL is reachable.
*
* @param string $url
* The URL to check.
* @return this
* @throws \LogicException
*/
@stevenvandervalk
stevenvandervalk / setup-certbot-script.sh
Created February 8, 2017 11:38
A bash script to install certbot and add crontab to renew the cert
#!/bin/bash
#
# This sets up Let's Encrypt SSL certificates and automatic renewal
# using certbot: https://certbot.eff.org
#
# - Run this script as root.
# - A webserver must be up and running.
#
# Certificate files are placed into subdirectories under
# /etc/letsencrypt/live/*.
@mrwweb
mrwweb / functions.php
Last active March 18, 2023 04:58
Example Child Theme Files
<?php
/*
Important!
Make sure to replace {my_} with your theme's unique prefix.
All future functions you write should use that same prefix.
Example: mrwnten_parent_theme_enqueue_styles()
*/
add_action( 'wp_enqueue_scripts', '{my_}parent_theme_enqueue_styles' );
@thagxt
thagxt / get-product-info.php
Created August 25, 2016 14:10
Magento 2 > product page > get Product URL, get Product Name and get Product ID
<?php
// get current page URL
$URL = $this->getUrl('*/*/*', ['_current' => true, '_use_rewrite' => true]);
// get current product name & ID
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product'); //get current product
$id = $product->getId();
$title = $product->getName();
@petrichor8
petrichor8 / Bootstrap 3 Carousel Fade Transition.markdown
Last active April 12, 2023 21:00
Bootstrap 3 Carousel Fade Transition
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 25, 2024 01:17
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@aindong
aindong / DynamicSetterGetter.php
Created April 16, 2015 15:47
Dynamic setter/getter using __call magic method of php
<?php
class Person
{
protected $firstName;
protected $lastName;
/**
* Magic method call for setter and getter
*
* @param $methodName
@jpospychala
jpospychala / gist:69d783f2eeeea1a9450e
Last active December 21, 2021 16:44
create DigitalOcean droplet from shell with curl and rcli
# this script expects $DOTOKEN variable with your digital ocean token
# this script gets or creates smallest DO droplet and remotely executes script on it
# afterwards, droplet is destroyed
DROPLETNAME=example.com
DOHOME="https://api.digitalocean.com/v2"
cat <<EOF > .curlargs
-s
-H "Authorization: Bearer $DOTOKEN"
@joonaspaakko
joonaspaakko / Export document for each layer inside selected group.jsx
Last active January 23, 2024 05:52
Photoshop script that saves the whole document for each top level layer inside the selected group.
// Name: Export document for each layer inside selected group.jsx
// Formerly: Export Layers Inside Selected Group.jsx
// Description: Photoshop script that saves the whole document for each top level layer inside the selected group.
// Image example: https://user-images.githubusercontent.com/1164476/49152494-aef8af00-f31b-11e8-80ff-d774e3103eae.png
// https://gist.github.com/joonaspaakko/013a223e94ba0fb9a2a0
#target photoshop