This file contains hidden or 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
MATCH (b:Book) | |
WHERE ANY ( tag IN b.tags WHERE tag IN ['nosql','neo4j'] ) | |
RETURN b.title,b.tags | |
SKIP 20 | |
ORDER BY b.title DESC | |
LIMIT 20 | |
------------ | |
MATCH (b:Book)<-[r:Votes]-(:User) |
This file contains hidden or 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
request = require 'request' | |
url = require 'url' | |
fs = require 'fs' | |
_ = require 'underscore' | |
base = 'http://www.puzzledragonx.com/en/img/monster/' | |
seqs = _.range(1000) | |
imageNames = seqs.map (n) -> "#{n+1}.jpg" | |
_.each imageNames, (img) -> |
This file contains hidden or 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
var H = Helper = { | |
pointInPolyon: function (n, vertices, touch) { | |
var i, j, c = false; | |
for (i = 0, j = n - 1; i < n; j = i++) { | |
if (((vertices[i].y > touch.y) != (vertices[j].y > touch.y)) && | |
(touch.x < (vertices[j].x - vertices[i].x) * (touch.y - vertices[i].y) / (vertices[j].y - vertices[i].y) + vertices[i].x )) { | |
c = !c; | |
} | |
} | |
return c; |
This file contains hidden or 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
require 'nokogiri' | |
require 'open-uri' | |
class ImageFetcher | |
EXCLUDES = [ | |
"http://a2.behance.net/img/site/grey.png" | |
] | |
def self.get_all_img_src(url) |
This file contains hidden or 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
javascript:(function() { | |
var $ = jQuery, | |
div = $('<div>').css({'position': 'fixed', 'width': '500px', 'left': '30%', 'top': '10%', 'background': 'red', 'padding': '20px'}), | |
ul = $('<ol>'), | |
cancel = $('<a>').addClass('.cancel').attr('href', '#').css({'float': 'right'}).text('X'); | |
cancel.appendTo(div); | |
div.append(ul); | |
$('body').append(div); | |
This file contains hidden or 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
// mainViewController | |
@interface MainViewController () <AwesomeViewController> | |
_awesomeViewController.delegate = self; | |
- (void)didSelectLabel; | |
// awesomeViewController | |
@protocol AwsomeViewControllerDelegate <NSObject> |
This file contains hidden or 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
typedef NSString* (^ConfigureNameBlock)(NSString *firstName, NSString *lastName); | |
- (void) runBlock | |
{ | |
NSString *suffix = @"i am in your back"; | |
NSString *(^configureName)(NSString *, NSString *) = ^(NSString *firstName, NSString *lastName) { | |
return [NSString stringWithFormat: @"%@, %@, %@", firstName, lastName, suffix]; | |
}; | |
This file contains hidden or 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
require 'nokogiri' | |
require 'open-uri' | |
class ImageFetcher | |
EXCLUDES = [ | |
"http://a2.behance.net/img/site/grey.png" | |
] | |
def self.get_all_img_src(url) |
This file contains hidden or 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
// Define directory and file path | |
NSString *documentDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; | |
NSString *filePath = [documentDir stringByAppendingPathComponent:@"file1.txt"]; | |
// Write NSArray to file | |
NSArray *numbers = @[@12, @124, @214214]; | |
[numbers writeToFile: filePath atomically:YES]; | |
NSError *error; |
This file contains hidden or 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
ACAccountStore *accountStore = [[ACAccountStore alloc] init]; | |
ACAccountType *twitterAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; | |
[accountStore requestAccessToAccountsWithType:twitterAccountType options:nil completion:^(BOOL granted, NSError *error) { | |
if (granted) { | |
ACAccount *account = [[accountStore accountsWithAccountType:twitterAccountType] lastObject]; | |
NSURL *url = [NSURL URLWithString: @"https://api.twitter.com/1.1/followers/list.json"]; | |
id params = @{@"skip_status" : @"1", @"screen_name":@"kyktommy", @"count": @"100"}; | |
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:url parameters:params]; | |
request.account = account; | |
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { |