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
from unittest import main, TestCase | |
class TestPrimeFactors(TestCase): | |
def testPrimesOf0to1(self): | |
self.assertEquals([], factorsOf(0)) | |
self.assertEquals([], factorsOf(1)) | |
def testPrimesOf2to4(self): | |
self.assertEquals([2], factorsOf(2)) | |
self.assertEquals([3], factorsOf(3)) | |
self.assertEquals([2,2], factorsOf(4)) |
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
package com.example.cpuid; | |
import android.app.Activity; | |
import android.os.Bundle; | |
public class CPUIdApp extends Activity | |
{ | |
/** Called when the activity is first created. */ | |
@Override | |
public void onCreate(Bundle savedInstanceState) | |
{ | |
super.onCreate(savedInstanceState); |
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
#include <stdio.h> | |
#define HT_FLAG 0x10000000 | |
#define SSE_FLAG 0x02000000 | |
#define SSE2_FLAG 0x04000000 | |
#define SSSE3_FLAG 0x00000200 | |
#define SSE4_1_FLAG 0x00080000 | |
#define SSE4_2_FLAG 0x00100000 | |
void cpuid(unsigned info, unsigned *eax, unsigned *ebx, unsigned *ecx, unsigned *edx) | |
{ |
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
package com.example.cpuid; | |
import android.app.Activity; | |
import android.os.Bundle; | |
import android.widget.TextView; | |
public class CPUIdApp extends Activity | |
{ | |
/** Called when the activity is first created. */ | |
@Override |
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
#include "com_example_cpuid_CPUIdApp.h" | |
extern void cpuid_parse(char *buf); | |
JNIEXPORT jstring JNICALL Java_com_example_cpuid_CPUIdApp_cpuid_1get(JNIEnv *env, jclass jc) | |
{ | |
char buf[1024]; | |
cpuid_parse(buf); | |
return (*env)->NewStringUTF(env, buf); | |
} |
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
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_MODULE := cpuid | |
LOCAL_SRC_FILES := cpuid.c com_example_cpuid_CPUIdApp.c | |
include $(BUILD_SHARED_LIBRARY) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Space Canvas</title> | |
</head> | |
<body> | |
<h1>Juego de nave espacial con Canvas</h1> | |
<canvas id="spaceCanvas" width="300" height="300"> | |
</canvas> | |
</body> |
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
// El evento se notifica cuando Entero cambia | |
void event IntEvento { | |
// variables de contexto | |
int x,y; | |
// Contrato translúcido. Iniciamos con precondición. | |
requires x < 25 && y < 120 | |
assumes { | |
next.invoke(); | |
establishes next.x() == old(next.x()); | |
} |
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
nodoptr = ^nodo; //el apuntador del nodo apunta a un nodo | |
nodo = record //esta es la definición del nodo | |
algúndato: string; //palabra a guardar | |
izquierda, derecha: nodoptr; | |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using Xamarin.Forms; | |
namespace SG { | |
public class App { | |
public static Page GetMainPage() { | |
return new ContentPage { |
OlderNewer