Skip to content

Instantly share code, notes, and snippets.

var t0 = performance.now();
doSomething();
var t1 = performance.now();
console.log("Call to doSomething took " + (t1 - t0) + " milliseconds.")
@alwerner
alwerner / SFTP with public key
Created August 13, 2012 15:28
SFTP with public key
host ftp.example.com
IdentityFile ~/.ssh/key-for-example.pem
HostName example.com
User foo
# Source: http://fetchsoftworks.com/fetch/messageboard/sftp-with-public-key-how
@alwerner
alwerner / ssh path to github repo
Last active October 9, 2015 08:08
ssh path to github repo
Make sure you're using the SSH one:
ssh://git@github.com/username/repo.git.
And NOT the https or git one.
Fix the url in the .git/config file.
@alwerner
alwerner / Git Remove Deleted Files
Last active October 10, 2015 10:27
Remove Deleted Files
# to remove already deleted files:
git add -u .
git commit -m "manually deleting files"
@alwerner
alwerner / php conditional loading based on host
Last active October 12, 2015 20:29
php conditional loading based on host
<?php
if ($_SERVER["HTTP_HOST"] == 'mydomain.com' || $_SERVER["HTTP_HOST"] == 'www.mydomain.com' ) {
// insert, for instance, analytics code here.
}
git rm -r --cached .
This removes everything from the index, then just run:
git add .
Commit it:
git commit -m ".gitignore is now working"
@alwerner
alwerner / Wordpress Custom Post Type Pagination
Last active December 1, 2015 22:40
for "news" custom post type
<?php
// Define custom query parameters
$custom_query_args = array(
'post_type' => 'news',
'orderby' => 'asc',
'paged' => $paged,
'posts_per_page' => 2
);
@alwerner
alwerner / Adding a git alias to .gitconfig
Last active December 13, 2015 19:38
Adding a git alias to .gitconfig
git config --global alias.<NAME> "<COMMAND>"