Skip to content

Instantly share code, notes, and snippets.

View jamiecalabro's full-sized avatar

Jamie Calabro jamiecalabro

View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@danielmartins
danielmartins / get_posts_between.php
Created March 16, 2013 01:29
Wordpress: Get posts between dates based on specific post meta field
<?php
/**
* Get posts in range date by a specific custom field(post meta)
* But, the date needs to be in the format YYYYMMDD
*
* @param string $start start date
* @param string $end end date
* @param string $field specific custom field
* @param string $ctype
@tobek
tobek / get-image-urls.js
Last active June 18, 2024 19:24
Save images from chrome inspector/dev tools network tab
/* open up chrome dev tools (Menu > More tools > Developer tools)
* go to network tab, refresh the page, wait for images to load (on some sites you may have to scroll down to the images for them to start loading)
* right click/ctrl click on any entry in the network log, select Copy > Copy All as HAR
* open up JS console and enter: var har = [paste]
* (pasting could take a while if there's a lot of requests)
* paste the following JS code into the console
* copy the output, paste into a text file
* open up a terminal in same directory as text file, then: wget -i [that file]
*/
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 3, 2024 16:25
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

@epschmidt
epschmidt / functions.php
Last active October 19, 2021 17:40
Add a checkbox to the Add/Edit Link popup in WordPress to add a 'button' class to links. Replaces default wplink.js script. Current as of WordPress 4.2.4.
<?php
// adds checkbox to make link a button
function add_class_wplink() {
wp_deregister_script( 'wplink' );
wp_register_script( 'wplink', get_template_directory_uri() . '/js/admin/wplink.js', array( 'jquery', 'wpdialogs' ), false, 1 );
wp_localize_script( 'wplink', 'wpLinkL10n', array(
'title' => __('Insert/edit link'),
'update' => __('Update'),
@diegomengarda
diegomengarda / UserController.php
Created March 4, 2016 17:56
paginação laravel
<?php namespace Admin\Http\Controllers\Admin;
use Admin\Http\Requests\Admin\UserRequest;
use Admin\Http\Controllers\Controller;
use Admin\Repositories\RoleRepository;
use Admin\Repositories\UserRepository;
use Admin\User;
use Illuminate\Http\Request;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Illuminate\Pagination\AbstractPaginator as Paginator;
@oddevan
oddevan / centos-initial-lamp.sh
Last active September 30, 2021 08:00
Shell script to set up CentOS 7 server with LAMP. Must be run as root interactively.
#!/usr/bin/env bash
# This is designed to get a CentOS 7 system up and running
# from absolutely nothing. It will install the LAMP stack
# as well as RVM and Phusion Passenger
# Run this as root
yum update
@dduvnjak
dduvnjak / add_cloudflare_ips.sh
Last active June 26, 2024 07:47
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# set the security group ID
SG_ID="sg-00000000000000"
# iterate over the IP ranges in the downloaded file
# and allow access to ports 80 and 443
while read p
do
@azizur
azizur / Creating a static copy of a dynamic website.md
Last active June 3, 2024 09:39
Creating a static copy of a dynamic website

The command line, in short…

wget -k -K -E -r -l 10 -p -N -F --restrict-file-names=windows -nH http://website.com/

…and the options explained

  • -k : convert links to relative
  • -K : keep an original versions of files without the conversions made by wget
  • -E : rename html files to .html (if they don’t already have an htm(l) extension)
  • -r : recursive… of course we want to make a recursive copy
  • -l 10 : the maximum level of recursion. if you have a really big website you may need to put a higher number, but 10 levels should be enough.
@ralphtheninja
ralphtheninja / cleanup_docker.sh
Created December 22, 2016 23:05 — forked from jaronkk/cleanup_docker.sh
Cleanup and reset docker on Jenkins workers / slaves
#!/bin/bash
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo
# Attempts to cleanly stop and remove all containers, volumes and images.
docker ps -q | xargs --no-run-if-empty docker stop
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes
docker volume ls -q | xargs --no-run-if-empty docker volume rm
docker images -a -q | xargs --no-run-if-empty docker rmi -f
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again.