This file contains 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
// unminifed version of https://apis.google.com/js/plusone.js | |
// see https://developers.google.com/+/plugins/+1button/#getting-started | |
window.___jsl = window.___jsl || {}; | |
window.___jsl.h = window.___jsl.h || 'm;\/_\/apps-static\/_\/js\/gapi\/__features__\/rt=j\/ver=zVTxVnVbJog.en_US.\/sv=1\/am=!FRwcaGMpC1CIJ0aI4g\/d=1\/'; | |
window.___jsl.l = []; | |
window.___gpq = []; | |
window.gapi = window.gapi || {}; | |
window.gapi.plusone = window.gapi.plusone || (function () { | |
function f(n) { |
This file contains 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
<?php | |
// problem | |
// Alice adds the numbers to list in the following order | |
// [1,4,7,10,2,5,8,3,6,9] | |
// The 7th number in the list is 8 | |
// solution | |
$b=[1,4,7,10,2,5,8,3,6,9]; |
This file contains 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
void MainWindow::createfile(){ | |
QString filename="test.txt"; | |
QFile file(filename); | |
if(!file.exists()){ | |
qDebug() << "NO existe el archivo "<<filename; | |
}else{ | |
qDebug() << filename<<" encontrado..."; | |
} | |
QString mesg="una segunda linea"; | |
if (file.open(QIODevice::WriteOnly | QIODevice::Text)){ |
This file contains 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
<?php | |
function convertCurrency($amount, $from, $to){ | |
$data = file_get_contents("https://finance.google.com/finance/converter?a=$amount&from=$from&to=$to"); | |
preg_match("/<span class=bld>(.*)<\/span>/",$data, $converted); | |
$converted = preg_replace("/[^0-9.]/", "", $converted[1]); | |
return number_format(round($converted, 3),2); | |
} | |
echo convertCurrency("10.00", "AED", "USD"); | |
?> |
This file contains 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
<?php | |
$host = '127.0.0.1'; | |
$user = 'abc'; | |
$pwd = 'abc'; | |
$db = 'xyz'; | |
$con = mysql_connect($host, $user, $pwd) or die("connection failed"); | |
mysql_select_db($db,$con) or die("db selection failed"); |
This file contains 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 (isPrime(number)) | |
{ | |
if ((number == 2) || (number == 3)) | |
return true; | |
if ((number % 2 === 0) || (number % 3 === 0)) | |
return false; | |
var maxDivisor = Math.sqrt(number); | |
var dividendIndex = 1; | |
var dividend = 5; |
This file contains 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
class intmult | |
{ | |
public: | |
virtual intmult(int a,int b)=0; | |
}; | |
class Multiply:public intmult | |
{ | |
public: | |
virtual intmult(int a,int b) | |
{ |
This file contains 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 'open-uri' | |
kittens = open('http://placekitten.com/') | |
response_status = kittens.status | |
response_body = kittens.read[559, 441] | |
puts response_status | |
puts response_body |
This file contains 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
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", "http://www.dragonwolverines.com/", false); | |
xhr.send(); | |
console.log(xhr.status); | |
console.log(xhr.statusText); |
This file contains 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
var my_canvas = document.getElementById("canvas"); | |
var context = my_canvas.getContext("2d"); | |
context.beginPath(); | |
context.arc(75,75,35,0,2*Math.PI); | |
context.fillStyle = "red"; | |
context.fillRect(10, 10, 50, 20); | |
context.font = "30px Garamond"; | |
context.fillText("Hello!",15,175); | |
context.stroke(); |
NewerOlder