Skip to content

Instantly share code, notes, and snippets.

@bradtraversy
bradtraversy / webdev_online_resources.md
Last active July 10, 2024 06:26
Online Resources For Web Developers (No Downloading)
Name: Flash
Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc=
if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676
Thank you!
@RebeccaWhit3
RebeccaWhit3 / windows-hosts-file.md
Last active August 5, 2017 07:44
Windows OS • HOSTS File

Windows OS: HOSTS file

0.0.0.0 vs. 127.0.0.1

@ http://www.dslreports.com/speak/print/default;24622031

Using 0.0.0.0 instead of 127.0.0.1 is indeed faster because you don't have to wait for a timeout. It also does not interfere if you are running a web server on the local PC.

If you use 0.0.0.0, you may want to add this entry just before your first 0.0.0.0 "blocking" entry:

@pqina
pqina / create-thumbnail.php
Last active June 29, 2023 18:13
Create thumbnails with PHP
<?
// Link image type to correct image loader and saver
// - makes it easier to add additional types later on
// - makes the function easier to read
const IMAGE_HANDLERS = [
IMAGETYPE_JPEG => [
'load' => 'imagecreatefromjpeg',
'save' => 'imagejpeg',
'quality' => 100
@ricardoaugusto
ricardoaugusto / distance-between-two-points.php
Last active May 7, 2016 13:46
Haversine Distance between two points ( latitude, longitude )
<?php
/**
* Distance between two points
*
* @param float $lat1 Latitude 1
* @param float $lng1 Longitude 1
* @param float $lat2 Latitude 2
* @param float $lng2 Longitude 2
* @param string $unit [mi|km] miles|kilometers
@Rodrigo54
Rodrigo54 / php-html-css-js-minifier.php
Last active July 12, 2024 10:42 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
@mokiding
mokiding / vnc_manual.txt
Last active November 10, 2022 04:55
How to install VNC server ubuntu digitalocean
just edit the vnc_user in this text
-------------------------------
apt-get install gnome-core xfce4 firefox
apt-get install vnc4server
adduser vnc_user
su - vnc_user
vncserver
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak
rm -rf ~/.vnc/xstartup
@elad
elad / neural-style-ec2.txt
Created September 7, 2015 08:09
Running neural-style in EC2
Start a g2.2xlarge or better (GPU instance) with https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-ffba7b94
Login, username is ubuntu
Update a bunch of stuff and make sure cudnn R2 is used:
luarocks install image
luarocks install loadcaffe
luarocks install torch
export LD_LIBRARY_PATH=/home/ubuntu/torch-distro/install/lib:/home/ubuntu/torch-distro/install/lib:/home/ubuntu/cudnn-6.5-linux-x64-v2-rc2
@sreigle
sreigle / radius-search.php
Created August 27, 2015 15:26
Radius search of post meta latitude and longitude
<?php
function radius_search($lat, $long, $distance = 100){
global $wpdb;
return $wpdb->get_results("SELECT DISTINCT item_latitude.post_id,
wp_posts.post_title,
((ACOS(SIN($lat * PI() / 180) * SIN(item_latitude.meta_value * PI() / 180) + COS($lat * PI() / 180) * COS(item_latitude.meta_value * PI() / 180) * COS(($long - item_longitude.meta_value) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) AS distance
FROM wp_postmeta AS item_latitude
LEFT JOIN wp_postmeta as item_longitude ON item_latitude.post_id = item_longitude.post_id
INNER JOIN wp_posts ON wp_posts.ID = item_latitude.post_id
WHERE item_latitude.meta_key = 'latitude' AND item_longitude.meta_key = 'longitude'
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 17, 2024 19:30
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