Skip to content

Instantly share code, notes, and snippets.

@sebyx07
sebyx07 / truncate.rb
Created May 31, 2020 14:52
rails truncate text, smart way
def truncate(text, max)
return text if text.size < max
last_word_index = text[max] == " " ? -1 : -2 # check if it's ending, then we can include it
text[0..max - 1].split(" ")[0..last_word_index].join(" ")
end
@sebyx07
sebyx07 / truncate.rb
Created April 21, 2020 13:45
Smart way to truncate string strings in ruby based on number of chars. It enforces the maxium size, so you don't get validation errors
module StringTruncate
def string_truncate(string, max_size, terminator="...")
size = 0
words = []
string.split.each do |word|
size += word.size
words << word
break if size >= max_size
size += 1
end
@sebyx07
sebyx07 / client_and_server.js
Last active October 19, 2019 21:51
JS React => Ruby HYPERSTACK.
Mui = require('@material-ui/core');
Mui.default = Mui;
<a href="http://www.ezsniper.com">
eBay sniper
</a>
test
@sebyx07
sebyx07 / tutorial.md
Last active April 11, 2024 16:22
Hack Age of Empires Online Celeste. Infinite population and resources

Run the trainer before in a quest!

1 Install Sandboxie https://www.sandboxie.com/

2 Run Celeste_Launcher_Gui.exe sandboxed

3 Run the Game

4 Alt tab

Verifying my Blockstack ID is secured with the address 14K9PN4un95zWoqBxYFDiL6TB6k2GN9KuQ https://explorer.blockstack.org/address/14K9PN4un95zWoqBxYFDiL6TB6k2GN9KuQ
.thumbnail .btn {
background-color: #3db935;
color: white;
margin-bottom: 4px;
}
.thumbnail img {
object-fit: cover;
height: 250px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Riders Club</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <!-- pt telefon, blocare zoom -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <!-- // librarie bootstrap -->
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css"> <!-- //fonturi -->
@sebyx07
sebyx07 / setup.sh
Last active September 12, 2017 09:54
setup
#!/bin/bash
# DOCKER
sudo apt-get update
sudo apt-get install git ruby -y
sudo apt-get install \
linux-image-extra-$(uname -r) \
linux-image-extra-virtual