Skip to content

Instantly share code, notes, and snippets.

(function () {
"use strict";
function parseBenefit(text) {
var type = "otro";
var value = "";
if (text != "") {
var numberPattern = /\d+/g;
var result = text.match(numberPattern);
@ferclaverino
ferclaverino / fotoscopadas.rb
Created December 12, 2012 12:00
Realizado por Gaby, del colegio Nehen Peuman, Bariloche
Shoes.setup do
gem "chunky_png"
end
require "chunky_png"
Shoes.app(:title => "Fotos copadas", :width => 800, :height => 600, :resize => true) do
stack do
title("Fotos copadas")
button("Load") do
@ferclaverino
ferclaverino / gist:4060395
Created November 12, 2012 16:41
Subscribe to WNS and register the channel
function subscribeToPushNotification() {
var channelOperation = Windows.Networking.PushNotifications
.PushNotificationChannelManager
.createPushNotificationChannelForApplicationAsync()
.then(function (newChannel) {
channel = newChannel;
// Insert the new channel URI into the Channel table.
var client = getMobileServiceClient();
var channelTable = client.getTable('Channel');
@ferclaverino
ferclaverino / gist:4060353
Created November 12, 2012 16:34
Insert Windows Mobile Services
function insertArticle(article) {
var client = getMobileServiceClient();
var item = { text: article.title, img: article.backgroundImage };
client.getTable("MostViewed").insert(item);
}
function getMobileServiceClient() {
var client = new Microsoft.WindowsAzure.MobileServices.MobileServiceClient(
"https://myMobileServicesApp.azure-mobile.net/",
"myMobileServicesAppIdhKXrnRFpwu70"
@ferclaverino
ferclaverino / fotoyop_chunky.rb
Created November 4, 2012 18:02
Image manipulation in shoes
Shoes.setup do
gem "chunky_png"
end
require "chunky_png"
Shoes.app(:title => "Fotoyop", :width => 800, :height => 600, :resize => true) do
stack do
title("fotoyop")
button("cargar imagen") do
filename = ask_open_file
Shoes.app(:title => "Fotoyop",
:width => 800,
:height => 600,
:resize => true) do
stack do
title(filename)
para
@img = image(filename)
para
@ferclaverino
ferclaverino / gist:3703195
Created September 12, 2012 00:14
Hey, I am offline
homeNewsQuery.getNews()
.then(function (news) {
// mostrar noticias
}, function (error) {
Offline.goOfflineMode();
});
@ferclaverino
ferclaverino / gist:3703149
Created September 12, 2012 00:04
offline.js
(function () {
"use strict";
var nav = WinJS.Navigation;
function goOfflineMode() {
ShowErrorPopup();
nav.navigate("/pages/bookmark/landingBookmark.html", null);
}
function ShowErrorPopup() {
@ferclaverino
ferclaverino / gist:3703082
Created September 11, 2012 23:48
BookmarkInLocalStorage, step 1
(function () {
"use strict";
var localstorage;
var bookmarks = [];
function saveBookmarksToStorage() {
localstorage["bookmarks"] = JSON.stringify(bookmarks);
}
@ferclaverino
ferclaverino / gist:3703065
Created September 11, 2012 23:44
bookmarkInLocalStorage
(function () {
"use strict";
var localstorage;
var bookmarks = [];
function saveBookmarksToStorage() {
localstorage["bookmarks"] = JSON.stringify(bookmarks);
}