This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/test2'); | |
const db = mongoose.connection; | |
db.on('error', console.error.bind(console, 'connection error:')); | |
db.once('open', function dbOpenCB(callback) { | |
console.log('open callback called'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<rss version="2.0" | |
xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" | |
xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
xmlns:wfw="http://wellformedweb.org/CommentAPI/" | |
xmlns:dc="http://purl.org/dc/elements/1.1/" | |
xmlns:wp="http://wordpress.org/export/1.2/" | |
> | |
<channel> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
DOCUMENTATION = ''' | |
--- | |
module: pdns_control | |
author: "James Sumners" | |
short_description: Issue pdns_control commands | |
requirements: [ pdns_control ] | |
description: | |
- Issue PowerDNS authoritative server pdns_control commands | |
options: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's return to screen | |
set-option -g prefix C-a | |
unbind-key C-b | |
# more intuitive keybindings for splitting | |
unbind % | |
bind h split-window -v | |
unbind '"' | |
bind v split-window -h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set d to the clipboard as «class PNGf» | |
set fid to open for access "/tmp/screenshot.png" with write permission | |
write d to fid | |
close access fid | |
-- http://www.michael-hogg.co.uk/applescript.php | |
-- helped me figure this one out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSData+Base64.h | |
// base64 | |
// | |
// Created by Matt Gallagher on 2009/06/03. | |
// Copyright 2009 Matt Gallagher. All rights reserved. | |
// | |
// This software is provided 'as-is', without any express or implied | |
// warranty. In no event will the authors be held liable for any damages | |
// arising from the use of this software. Permission is granted to anyone to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface NSDictionary (JBSObjectForPath) | |
/** | |
Returns the object from a nested `NSDictionary` at the given path, with path | |
components separated by a "/". For example, if you have the following | |
dictionary: | |
~~~~ | |
{"foo":{"bar":"foobar"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
@interface UIColor (JBSUtilities) | |
/** | |
Give it a hex string, e.g. "#FFEEDD" or "FFEEDD", get back the UIColor | |
representation. | |
@param stringToConvert A NSASCIIStringEncoding hex string. | |
@return The UIColor represented by the hex string. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#define IS_IPHONE (!IS_IPAD) | |
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPhone) | |
/** | |
Provides a few methods to determine what sort of device the application is | |
running on. Specifically, the methods make it easy to determine what sort of | |
iPhone resolution is available: `[[UIApplication sharedApplication] isIphone3]` | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters