Skip to content

Instantly share code, notes, and snippets.

{
code = 0;
cursor = {
hasNext = 0;
hasPrev = 0;
id = "0:0:0";
more = 0;
next = "0:0:0";
prev = "<null>";
total = "<null>";
// Function: getCopyAndMakeNextMove
//
// Desc: Creates a copy of the current object then performs the makeNextMove
// function on it, advancing it to its next state.
//
// Pre: None.
//
// Post: A new object is returned and the next move is taken from the stack.
Board getCopyAndMakeNextMove()
{
#import <Foundation/Foundation.h>
@interface NSString (Extensions)
+ (NSString *)timeAgoStringFromDate:(NSDate *)fromDate;
@end
(defn file-maps [#^String dir]
(let [files (file-seq (File. dir))
names (map #(.getName %) files)
paths (map #(.getPath %) files)]
(map (fn [name path] (assoc {} :title name :path path
:lines (ds/read-lines path)))
names paths)))
# Init with your API key. To find out your key visit
# http://disqus.com/api/get_my_key while logged in to disqus.com.
disqus = Disqus(secret_key)
# Get a list of forums that user owns
disqus.forum_list()
# Get a list of posts on a forum
disqus.forum_posts(forum_id=1)
// Create a new instance of the entity managed by the fetched results controller.
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
Account *account = [NSEntityDescription insertNewObjectForEntityForName:[entity name]
inManagedObjectContext:context];
[account setValue:[userDict valueForKey:@"username"] forKey:@"username"];
[account setValue:[userDict valueForKey:@"password"] forKey:@"password"];
[account getAvatar];
#!/bin/bash
# A basically sane bash environment.
#
# Ryan Tomayko <http://tomayko.com/about> (with help from the internets).
# setup some basic variables
: ${HOME=~}
: ${LOGNAME=$(id -un)}
: ${UNAME=$(uname)}
"""
# Test File
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
vitae `enim` a turpis pellentesque aliquet. Quisque aliquam
vestibulum sem, ac ultrices neque dignissim ultricies.
Nam posuere [tempor](http://google.com) metus, in porta ante convallis
quis. Mauris ut vestibulum nibh. Quisque et lacinia augue. Ut bibendum vestibulum risus vitae dignissim.
In hac habitasse platea dictumst. Mauris scelerisque risus luctus
# post.rb
class Post < ActiveRecord::Base
has_attached_file :upload
validates_presence_of :title
end
# posts_controller.rb
data = grab_data_for(@post)
file = StringIO.new(data)
#container {
width: 680px;
margin: 2em auto;
}
.column {
float: left;
width: 60%;
padding: 2em 0;
}