Skip to content

Instantly share code, notes, and snippets.

@resting
resting / script.js
Created August 19, 2014 08:07 — forked from Rafailong/script.js
Div full Width/Height of viewport with jQuery
// global vars
var winWidth = $(window).width();
var winHeight = $(window).height();
// set initial div height / width
$('div').css({
'width': winWidth,
'height': winHeight,
});

How to setup your VMWare Fusion 6 images to use static IP addresses on Mac OS X

At Crush + Lovely, we use Railsmachine's Moonshine to automate the configuration of our servers. When writing our deployment recipes, VMWare Fusion's ability to take snapshots and rollback to these snapshots is a huge timesaver because it takes just seconds to roll a server image to it's original state.

When you're just configuring a single server, having a static IP address for your server image isn't too important, but when you're configuring multi-server setups, it can be useful to duplicate a number of server images and give each a static IP address so you can consistently deploy to them. While not documented well at all, it turns out that this is relatively easy to accomplish in four simple steps.

1. Determine the MAC address of your guest machine

Let's say you have a guest machine with the name ubuntu-lucid-lynx-base

@resting
resting / main.js
Last active August 29, 2015 14:22
Slide Menu
slideMenu.build('slider', 460);
@resting
resting / gist:716214
Created November 26, 2010 02:50
Drupal page template on nodetype
/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {
// Add page template suggestions based on node type, if we aren't editing the node.
if ($vars['node'] && arg(2) != 'edit') {
$vars['template_files'][] = 'page-nodetype-'. $vars['node']->type;
}
@resting
resting / thememe
Created January 16, 2012 23:58
Simple script that creates empty base files for Drupal 7 theme
touch thememe.info
touch style.css
touch page.tpl.php
touch region.tpl.php
touch block.tpl.php
touch node.tpl.php
touch comment-wrapper.tpl.php
touch comment.tpl.php
touch template.php
mkdir images
@resting
resting / gist:1632284
Created January 18, 2012 10:10
PHP Save array to file
<?php
$data=array(
"name"=>"beckham",
"address"=>"LA"
);
$filename = 'data.txt';
$string = '';
foreach($data as $key => $val) {
@resting
resting / dbb
Created June 3, 2012 06:07
backup mysql script
# replace [] with your own config
# replace own dir to save
# echo doesn't work. hmm...
mysql -u[uname] -p'[pwd]' -e "show databases" \
| grep -Ev 'Database|information_schema' \
| while read dbname; \
do \
echo 'Dumping $dbname' \
mysqldump -u[uanme] -p'[pwd]' $dbname > ~/db_backup/$dbname.sql;\
@resting
resting / markdown.xml
Created July 22, 2012 10:16 — forked from lg0/markdown.xml
Markdown Syntax Highlighting for Sublime text 2
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>
@resting
resting / Default (OSX).sublime-keymap
Last active October 9, 2015 02:08
Sublime Key Binding
[
{
"keys" : ["alt+shift+w"],
"command" : "insert_snippet",
"args": {
"contents": "<${1:p}>${0:$SELECTION}</${1}>"
}
},
{ "keys": ["j", "j"], "command": "exit_insert_mode",
"context":
@resting
resting / Preferences.sublime-settings
Last active October 11, 2015 03:48
Sublime User Settings
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_centered": true,
"font_size": 10.0,
"gutter": true,
"ignored_packages":
[
"SyncedSideBar"
],
"indent_guide_options":