Skip to content

Instantly share code, notes, and snippets.

@Nilpo
Nilpo / colors.xml
Last active September 12, 2022 16:50 — forked from drewis/colors.xml
Material design color palettes for Android
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- app color palette -->
<color name="primary">@color/indigo_500</color>
<color name="primary_light">@color/indigo_100</color>
<color name="primary_dark">@color/indigo_700</color>
<color name="accent">@color/pink_A200</color>
<color name="accent_fallback_light">@color/pink_A100</color>
<color name="accent_fallback_dark">@color/pink_A400</color>
// --------------------------------------------------------------------------------------
// A More Modern Scale for Web Typography
// Based on this article: http://typecast.com/blog/a-more-modern-scale-for-web-typography
// --------------------------------------------------------------------------------------
$body-font-size: 1em !default;
// Adjusts body typography to be default
// for each browser.
@mixin reset-body-font-size($font-size: 100%, $size-adjustment: 0.5) {
@Nilpo
Nilpo / Using Git to Manage a Live Web Site.md
Last active April 26, 2024 19:09
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@Nilpo
Nilpo / pdf.php
Created November 21, 2015 04:39
Serving PDF Files While Retaining Canonicalization
<?php
/**
* A sample file used for serving PDF files while retaining canonicalization.
*
* You will need something like the following in .htaccess:
*
* RewriteRule ^(.+)\.pdf /pdf.php?file=$1 [L]
*/
@Nilpo
Nilpo / wpbackup.sh
Created December 8, 2015 23:27
A Wordpress Backup Shell Script
#!/bin/bash
# usage: ./wpbackup.sh domain.com
DOMAIN="$1"; # domain name to backup
BACKUP="$HOME/backups"; # store backups here
HOSTPATH="$HOME"; # path where hosted domains are
backmeup () {
local _N _U _P _H FS FT TD WP;
@Nilpo
Nilpo / backup.sh
Created December 15, 2015 01:10
Website backup script
#!/bin/bash -x
NOW=$(date +"%Y-%m-%d-%H%M)
FILE="domain.com.$NOW.tar"
BACKUP_DIR="/home/user/backups"
WWW_DIR="/home/user/domain.com/"
DB_HOST="mysql.domain.com"
DB_USER="dbuser"
DB_PASS="dbpass"
DB_NAME="dbname"
@Nilpo
Nilpo / Installing The Sword Project.md
Last active March 5, 2023 01:06
Instruction for installing The Sword Project on Mac and Linux. This is intended for module developers.

Installing The Sword Project

I found installing Sword from source to be problematic on both Mac and Linux. Thankfully, I found hidden in some documentation that it is available through common repositories. Unfortunately, the documentation was not thorough. Here's what worked for me on Mac OSX 10.9.5 and Linux Mint 17.3 "Rosa". These instructions should work on any recent version of Mac and any flavor of Ubuntu.

Installing Sword Package

The process for installing Sword differs a bit between Mac and Linux. I used Homebrew on Mac, but MacPorts should work just fine. Linux was a little less friendly, but I did get it working.

Instructions for Mac Users

@Nilpo
Nilpo / ttf2woff2.md
Created December 22, 2015 23:35 — forked from sergejmueller/ttf2woff2.md
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@Nilpo
Nilpo / getExternalIP.html
Created January 1, 2016 10:52
Use WebRTC to get an external IP address in JavaScript. https://jsfiddle.net/Nilpo/9qfo46ac/
<!DOCTYPE html>
<html lang="en">
<head>
<title>What is my IP?</title>
</head>
<body>
<p>External IP: <span id="result"></span></p>
<iframe id="iframe" sandbox="allow-same-origin" style="display: none"></iframe>
<script>
@Nilpo
Nilpo / password_api_test.php
Created January 8, 2016 08:52
A simple PHP script for testing what cost you should use with your server for password_hash() in PHP 5.5.0+
<?php
/**
* This code will benchmark your server to determine how high of a cost you can
* afford. You want to set the highest cost that you can without slowing down
* you server too much. 8-10 is a good baseline, and more is good if your servers
* are fast enough. The code below aims for ≤ 50 milliseconds stretching time,
* which is a good baseline for systems handling interactive logins.
*/
function_exists('password_hash') or die("Please use PHP 5.5.0 or higher.");