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
/** | |
* Module dependencies. | |
*/ | |
require.paths.unshift('./node_modules'); | |
var express = require('express'); | |
var assetManager = require('connect-assetmanager'); | |
var work = require('./models/work.js'); //the data model. | |
var user = require('./models/user.js') //the user model. | |
var app = module.exports = express.createServer(); |
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
def refnr(source) | |
#this takes a ID string with number but declared as string and returns a valid reference number | |
chk = 0 #the integrity check number | |
weights = [7, 3, 1] #hash weights, declared by THE GOVERNMENT | |
source.split('').reverse.each_with_index { |x, i| chk += (x.to_i)*weights[i%3] } #does the caluclation | |
return "#{source}#{((10-(chk%10))%10)}" #returns the input number with the check number trailing it | |
end |
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
function refnr(source) { | |
var chk = 0; | |
var weights = [7,3,1]; | |
for( var i=0; i<source.length; i++ ) { | |
chk += (source[source.length-i-1]-'0')*weights[i%3]; | |
} | |
return source+((10-(chk%10))%10); | |
} |
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
$("form").submit(function () { //fångar submit action från <form> taggen, om det sker så exkveras funktionen i fråga | |
if ($("#yourName").val()=="" || $("#friendEmail").val()=="") { //om taggen med id="yourname" (# == id) har inget i sitt värde (är tom), samma för id="friendEmail". | |
smoke.signal($(this).data("validation"), 4000); //Avfyrar ett meddelande till smokejs, inte jquery, ignore. | |
} else { | |
/* lite mera knepig jquery, vi gör en POST request (i HTTP finns det GET, POST, PUT, DELETE typer av requests), jag gör denna med jquery för att göra den i bakgrunden (s.k. AJAX, Asynchronous Javascript and XML), jag skickar de ovannämnda formulärfältens värden, som vi vet att inte är tomma, och ett locale fällt som är gömt för användaren, om lyckat så avfyras funktionen function(d) {} som är definierad i anropet */ | |
$.post('http://www.dermoshop.fi/makeup/api.asp', | |
{ yourName: $("#yourName").val(), friendEmail: $("#friendEmail").val(), locale: $("body").data("locale")}, | |
function(d) { // om servern tar emo |
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 'sinatra' | |
require 'fileutils' | |
require 'date' | |
require 'json' | |
set :port, 1337 | |
set :public, './data' |
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
New request: | |
{ socket: | |
{ bufferSize: 0, | |
fd: 8, | |
type: 'tcp4', | |
allowHalfOpen: true, | |
_readWatcher: | |
{ socket: [Circular], | |
callback: [Function: onReadable] }, | |
destroyed: false, |
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
// | |
// TaskViewController.m | |
// RecPotato | |
// | |
// Created by Karl Herler on 8/9/11. | |
// Copyright 2011 __MyCompanyName__. All rights reserved. | |
// | |
#import "TaskViewController.h" | |
#import <MobileCoreServices/UTCoreTypes.h> |
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
// | |
// TaskViewController.m | |
// RecPotato | |
// | |
// Created by Karl Herler on 8/9/11. | |
// Copyright 2011 __MyCompanyName__. All rights reserved. | |
// | |
#import "TaskViewController.h" | |
#import <MobileCoreServices/UTCoreTypes.h> |
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
//in Album.java | |
String name; //The name of the album | |
private Set<Photo> photos; //The actual photos | |
private Album parent; //The parent of this Album | |
private Set<Album> children; //The child nodes for this Album | |
Album(String n, Album p) { | |
this.name = n; |
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
[ | |
{ | |
photo: 12345.png, | |
name: River Girl, | |
products: [ | |
{name: Nice top, permalink: nice-top}, | |
{name: Flower Dress, permalink: flower-dress} | |
] | |
}, | |
{ |