Skip to content

Instantly share code, notes, and snippets.

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")
@NightZpy
NightZpy / SumOneToIntArray.py
Last active November 7, 2017 10:37
null created by NightZpy - https://repl.it/NsLs/1
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:
@NightZpy
NightZpy / post_confirm_refactored.php
Last active October 23, 2017 01:04
Refactor method post_confirm for Rappi Backend Test
<?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']);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test page</title>
</head>
<body>
<div class="a">
a
<div class="b">b</div>
<?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]));
<!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>
<?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 ) ) {
<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' }
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 })
-- Say we have this table called selected_colors:
-- +----------------+
-- | type | value |
-- +--------+-------+
-- | blue | 1 |
-- | red | 4 |
-- | yellow | 8 |
-- | red | 12 |
-- | blue | 5 |
-- | blue | 0 |