Skip to content

Instantly share code, notes, and snippets.

View alvises's full-sized avatar

Alvise Susmel alvises

View GitHub Profile
@alvises
alvises / save_load_cookies.js
Created September 16, 2015 16:09
Save and Load cookies in a CasperJS script
var fs = require('fs');
function saveCookies(cookiesPath) {
var cookies = JSON.stringify(phantom.cookies);
fs.write(cookiesPath, cookies, 644);
}
function loadCookies(cookiesPath) {
var data = fs.read(cookiesPath);
phantom.cookies = JSON.parse(data);
}
def import
params[:import]
begin
Learner.import(params[:file], current_user)
rescue Exception => e
render json: e and return
end
redirect_to groups_path, notice: "Successfully imported!"
end
#import "PopOverTestowyViewController.h"
#import "FPPopoverController.h"
-(IBAction)otwieramPopover:(id)sender{
//SAFE_ARC_RELEASE(popover); popover=nil;
//You have set "testController" as the identifier of your PopOverTestowyViewController in storyboard
PopOverTestowyViewController *mojController=[self.storyboard instantiateViewControllerWithIdentifier:@"testController"];
//mojController.delegate = self;
FPPopoverController *popover=[[FPPopoverController alloc]initWithViewController:mojController];
@alvises
alvises / gist:10675052
Created April 14, 2014 19:08
insert for loop
for(i=0; i < 10; ++i) {
db.posts.insert({
_id: i,
title: "Article number "+i
});
}
@alvises
alvises / gist:10652679
Last active August 29, 2015 13:59
Insert document in posts collection
db.posts.insert({
title: "A MongoDB article",
content: "...",
author: {
name: "Alvise Susmel",
email: "[email protected]"
},
tags: ["mongodb", "nosql"]
});