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
from builtins import NotImplementedError | |
class Persona: | |
def __init__(self, nombre): | |
self.nombre = nombre | |
def saludar(self): | |
raise NotImplementedError("Este método debe ser implementado por " | |
"las clases hijas o derivadas") |
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
import time | |
def add_one (data, last_pos): | |
last = data[last_pos] | |
if last < 9: | |
data[last_pos] = data[last_pos] + 1 | |
return data | |
if last_pos >= 0: | |
if last == 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
<?php | |
public function post_confirm_refactored() { | |
$service = Service::find(Input::get('service_id')); | |
if (!$service) { | |
return Response::json(['error' => '3']); | |
if ($service->status_id == '6') | |
return Response::json(['error' => '2']); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Test page</title> | |
</head> | |
<body> | |
<div class="a"> | |
a | |
<div class="b">b</div> |
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 | |
$text = $_POST['text']; | |
$color = $_POST['color']; | |
function base64_to_jpeg($base64_string, $output_file) { | |
$ifp = fopen($output_file, "wb"); | |
$data = explode(',', $base64_string); | |
fwrite($ifp, base64_decode($data[1])); |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Text to Image</title> | |
</head> | |
<body> | |
<textarea name="text" placeholder="Test here..."></textarea> | |
<label>Select Hex Color: </label> | |
<input type="text" placeholder="#000000" value="#000000" name="color"> | |
<button id="send" type="button">Get Image</button> |
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 | |
$folder = ['file1.txt', 'file2.txt', 'subfolder1' => ['subfolder2' => ['file3']]] ; | |
$printFolder = function( $folder, $key = 'folder', $i = 0 ) use ( &$printFolder ) | |
{ | |
$tab = str_repeat ('--', $i); | |
if ( isset ( $key ) ) | |
print ( "$tab $key:\n" ); | |
foreach ($folder as $key => $file) { | |
if ( is_array ( $file ) ) { |
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
<template> | |
<validator name="validation"> | |
<form novalidate> | |
<h1>user registration</h1> | |
<div class="username"> | |
<label for="username">username:</label> | |
<input id="username" type="text" | |
detect-change="off" v-validate:username="{ | |
required: { rule: true, message: 'required your name !!' }, | |
exist: { rule: true, initial: 'off' } |
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
Vuevalidator.asset('exist', function (val) { | |
return function (resolve, reject) { | |
// server-side validation with ajax (e.g. using `fetch` case) | |
fetch('/validators/exist', { | |
method: 'post', | |
headers: { | |
'content-type': 'application/json', | |
'x-token': 'xxxxxxxx' | |
}, | |
body: JSON.stringify({ username: val }) |
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
-- Say we have this table called selected_colors: | |
-- +----------------+ | |
-- | type | value | | |
-- +--------+-------+ | |
-- | blue | 1 | | |
-- | red | 4 | | |
-- | yellow | 8 | | |
-- | red | 12 | | |
-- | blue | 5 | | |
-- | blue | 0 | |
NewerOlder