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
int main () { | |
pthread_t thread1, thread2; | |
char message1[] = "I am thread 1"; | |
char message2[] = "I am thread 2"; | |
int numero = 102; | |
int iret1, iret2; | |
pthread_attr_t attr; | |
pthread_attr_init(&attr); |
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 split_pages(currentpage, totalpages): | |
""" | |
Splits a certain number of pages into several | |
lists; for example, if the current page is 31 on a total of 115 | |
pages the return tuple is: | |
([1, 2, 3, 4], [27, 28, 29, 30, 31, 32, 33, 34], [112, 113, 114, 115]) | |
""" | |
# Check if currentpage is less than the total | |
if currentpage > totalpages: |
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
# -*- coding: utf-8 -*- | |
""" | |
Order | |
~~~~~ | |
Determina il numero minimo di mosse per ordinare un | |
array di elementi sapendo che è possibile spostare un | |
qualsiasi elemento in cima o in fondo. |
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
/* Defines a function in the prototype of all | |
* functions: | |
* | |
* Usage: Function.method('add', add); | |
* var f = function() {}; | |
* f.add(1,2); | |
*/ | |
Function.prototype.method = function (name, func) { | |
// Creates a new property; this points to the Function object. |
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
7 | |
20 | |
40 | |
9 | |
11 | |
8 | |
4 | |
2 | |
31 |
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
window.tests = { | |
"make": function(){ | |
for(var i = 0; i<250; i++){ | |
$("<ul class='fromcode'><li>one</li><li>two</li><li>three</li></ul>") | |
.attr("id", "setid" + i) | |
.appendTo("body"); | |
} | |
return $("ul.fromcode").length; | |
}, |
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
# encoding: utf-8 | |
require 'socket' | |
class Chatty | |
def initialize | |
@clients = [] | |
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
# encoding: utf-8 | |
require 'socket' | |
class Chatty | |
def initialize | |
@clients = [] | |
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
module MonkeyIrb | |
def self.included(base) | |
# Monkey-patching Array | |
class << Array | |
def toy(n=10, &block) | |
block_given? ? Array.new(n, &block): Array.new(n) { |i| i + 1 } | |
end | |
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
preg_split('/(?=[A-Z])/',$str); |
OlderNewer