Skip to content

Instantly share code, notes, and snippets.

@da-n
da-n / twitter-bootstrap-scaffolding-in-pixels-breakdown.md
Last active December 10, 2015 23:55
Twitter Bootstrap scaffolding breakdown in pixels
# Twitter Bootstrap scaffolding breakdown in pixels
## responsive-1200px-min
* margin-left: 30px
* span1 - 70px
* span2 - 170px
* span3 - 270px
* span4 - 370px
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Multicelldesign CSS Ribbon</title>
<!-- Don't forget to add an HTML5 polyfill for IE -->
</head>
<body>
<div class="wrapper">
<nav role="navigation" aria-label="main menu">
@da-n
da-n / gist:5062463
Created March 1, 2013 04:22
Sum of integer values in an array using jQuery. Credit: gion_13 Source: http://stackoverflow.com/a/8550489/695454
$.sum_arr_int = function (arr) {
var r = 0;
$.each(arr, function (i, v) {
r += v;
});
return r;
};
var sum = $.sum_arr_int([20, 40, 80, 400]);
@da-n
da-n / WordPress -> Permalink Settings -> Custom Structure
Created March 22, 2013 13:11
/blog/%year%/%monthnum%/%day%/%postname%/
@da-n
da-n / update-git-submodule.md
Last active December 15, 2015 10:39
Update Git Submodule

Get the submodule initially

$ git submodule add git://github.com/twitter/bootstrap.git lib
$ git submodule init

Time passes, submodule upstream is updated and you now want to update change to the submodule directory

$ cd submodule_dir

Checkout desired branch

Updating homebrew fails

$ brew update

Error such as:

error: Your local changes to the following files would be overwritten by merge:
    README.md
Please, commit your changes or stash them before you can merge.

Aborting

@da-n
da-n / gist:5681425
Last active December 17, 2015 22:19
NodeJS: Basic App #snippet
var http = require('http');
server = http.createServer(function(req, res){
res.writeHead(200, {"Content-Type": "text/html"});
res.write("<html><body><h1>Hello, World!</h1></body></html>");
res.end();
}).listen(3000);
@da-n
da-n / wp-permissions.sh
Last active December 18, 2015 08:49
Configures WordPress file permissions based on recommendations
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
# Modofied by Daniel Davidson
#
WP_OWNER=wpowner # <-- wordpress owner
WP_GROUP=wpgroup # <-- wordpress group
@da-n
da-n / server_config.md
Last active April 21, 2016 20:08
Basic server config.

Server config

This is a collection of condensed, edited articles to aid in setting up a new server. Credits are at the bottom of this document.

Initial server setup

1. Login

Login as the main user:

Node.js

sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

It installs current stable Node on the current stable Ubuntu. Quantal (12.10) users may need to install the software-properties-common package for the add-apt-repository command to work: