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
@props(['url', 'field', 'error', 'selected' => null, 'extra' => null]) | |
<div wire:ignore> | |
<select {{ $attributes->merge(['style' => 'width:100%', 'class' => 'mt-1 block w-full py-2 px-3 bg-white rounded-md shadow-sm focus:outline-none | |
sm:text-sm'])->except('wire:model') }}> | |
@if ($selected)<option value="{{ $selected[0] }}" selected="selected">{{ $selected[1] }}</option>@endif | |
</select> | |
</div> | |
@if (!empty($error))<span class="text-red-500 text-sm">{{ $error }}</span>@endif |
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 { useState, useEffect } from 'react'; | |
import api from 'utils/api'; | |
const useFecth = (url, params) => { | |
const [response, setResponse] = useState(null); | |
const [error, setError] = useState(null); | |
const [isLoading, setIsLoading] = useState(true); | |
useEffect(() => { |
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
Promise.allValues = async (object) => { | |
return _.zipObject(_.keys(object), await Promise.all(_.values(object))) | |
} |
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
const memoize = function(f) { | |
let cache = {}; | |
return function(...args) { | |
const arg_str = JSON.stringify(args); | |
cache[arg_str] = cache[arg_str] || f.apply(f, args); | |
return cache[arg_str]; | |
} | |
} |
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
const greaterThan = (thisNumber) => (anotherNumber) => anotherNumber > thisNumber; | |
const greaterThan10 = greaterThan(10); | |
const greaterThan2 = greaterThan(2); | |
console.log('12 > 10 = ', greaterThan10(12)); // 12 > 10 = True | |
console.log('8 > 10 = ', greaterThan10(8)); // 8 > 10 = False | |
console.log('3 > 2 = ', greaterThan2(3)); // 3 > 2 = True |
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 random import choice | |
from string import ascii_lowercase, ascii_uppercase, digits | |
from tkinter import Tk, Entry, Button, StringVar | |
def random_string(length): | |
return ''.join(choice(ascii_lowercase + digits + ascii_uppercase) for i in range(length)) | |
root = Tk() | |
root.title('32 chars random string generator') |
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 | |
/* index.html */ | |
class __TwigTemplate_37a968442c22648ceb4a16069820cc5350b97e50f45f26c5442d7c036ad743d2 extends Twig_Template | |
{ | |
public function __construct(Twig_Environment $env) | |
{ | |
parent::__construct($env); | |
$this->parent = $this->env->loadTemplate("base.html"); |
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
Traceback (most recent call last): | |
File "C:\Anaconda\lib\site-packages\flask\app.py", line 1836, in __call__ | |
return self.wsgi_app(environ, start_response) | |
File "C:\Anaconda\lib\site-packages\flask\app.py", line 1820, in wsgi_app | |
response = self.make_response(self.handle_exception(e)) | |
File "C:\Anaconda\lib\site-packages\flask\app.py", line 1403, in handle_exception | |
reraise(exc_type, exc_value, tb) | |
File "C:\Anaconda\lib\site-packages\flask\app.py", line 1817, in wsgi_app | |
response = self.full_dispatch_request() | |
File "C:\Anaconda\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request |
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 | |
class Foo | |
{ | |
private $dynamicMethods = array(); | |
public function __call($name, $arguments=array()) | |
{ | |
if(isset($this->dynamicMethods[$name]) and is_callable($this->dynamicMethods[$name])){ | |
call_user_func_array($this->dynamicMethods[$name], $arguments); |
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 collections import Counter | |
def cek(string): | |
if len(string) >= 2: | |
return True if sum([1 for i in Counter(string).most_common() if i[1] >= 2]) >= 2 else False | |
return False | |
print cek('aaabbcdeg') | |
print cek('aaaaaaaaab') | |
print cek('absjedeo') | |
print cek('aaaabbbbbccccdd') |
NewerOlder