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 isPalindrome(str) { | |
str = str.replace(/[^a-z0-9]/i, '').toLowerCase(); | |
if ( str.length === 0) { | |
return true; | |
} | |
let left = 0; | |
let right = str.length - 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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>PHP + Turbo + Stimulus</title> | |
<script src="/javascript/turbo.es2017-umd.js"></script> | |
<script src="/javascript/stimulus.umd.js"></script> | |
<script src="/javascript/controllers/index_controller.js" data-turbolinks-track="reload"></script> | |
</head> | |
<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
# Leetcode: Longest Substring Without Repeating Characters | |
# --------------------------------------------------------- | |
# | |
# script is an implementation of the sliding window technique to find the | |
# length of the longest substring without repeating characters in a given | |
# string. | |
def length_of_longest_substring(s) | |
# Empty hash to store the last index of each character in the string. | |
char_index = {} |
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
# Ruby version leetcode problem two_sum | |
def two_sum(nums, target) | |
hash = {} | |
nums.each.with_index do |k, i| | |
return [ hash[target - k], i ] if hash.key?(target - k) | |
hash[k] = i | |
end | |
end | |
data = [2,1,5,4,9,6] |
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 | |
use \App\Models\User; | |
use Illuminate\Support\Str; | |
$users = User::where('role', 'user')->get(); | |
foreach($users as $user) { | |
$newPassword = Str::random(12); | |
$user->password = bcrypt($newPassword); |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
https://www.reuse.cl/pages/cyberdays-2023 | |
https://oportutek.cl/ | |
https://www.segurycel.cl/ | |
https://www.cardinale.cl/ | |
https://pininaonline.com/ | |
https://sitio.consorcio.cl/promociones/black?utm_source=CCS&utm_medium=referall&utm_campaign=black_friday | |
https://www.kross.cl/cyber | |
https://bit.ly/cyberCL | |
https://www.sdn.cl/BlackFriday | |
https://bit.ly/3qaJDXi |
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
➜ nexstep-backend git:(master) ✗ bundle exec rake db:schema:load --trace | |
warning: parser/current is loading parser/ruby27, which recognizes2.7.5-compliant syntax, but you are running 2.7.2. | |
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri. | |
rake aborted! | |
NoMethodError: undefined method `reject' for #<String:0x00007ff525db2730> | |
/Users/juanpabloaqueveque/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/figaro-1.2.0/lib/figaro/application.rb:64:in `global_configuration' | |
/Users/juanpabloaqueveque/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/figaro-1.2.0/lib/figaro/application.rb:32:in `configuration' | |
/Users/juanpabloaqueveque/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/figaro-1.2.0/lib/figaro/application.rb:42:in `each' | |
/Users/juanpabloaqueveque/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/figaro-1.2.0/lib/figaro/application.rb:36:in `load' | |
/Users/juanpabloaqueveque/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/figaro-1.2.0/lib/figaro.rb:23:in `load' |
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
# Tarea: | |
# | |
# Se tiene una página que muestra información tabulada usando DIVs | |
# Se quiere convertir a una tabla HTML. | |
# | |
# Solución: | |
# | |
# Para implementar esta solución nos ayudaremos de dos librerías o gemas | |
# | |
# 1. http - https://github.com/httprb/http |
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
# Documentales netflix recomendados | |
require 'http' | |
require 'nokogiri' | |
url = "https://mashable.com/article/best-documentaries-netflix" | |
content = HTTP.follow.get url | |
doc = Nokogiri::HTML content.to_s | |
doc.css('h2 em').each do |x| | |
puts x.content | |
end |
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
Bootic.require([ 'Util' ], function(util){ | |
var ajax = util.ajax, | |
buttonAsyncProducts = document.querySelector('.load-async-products'), | |
target = document.querySelector('.async-list > div'); | |
buttonAsyncProducts.addEventListener('click', function(e){ | |
var res = ajax('get', '/partials/custom-list-products', e.target.dataset, function(code, body){ |
NewerOlder