Skip to content

Instantly share code, notes, and snippets.

View davit-khaburdzania's full-sized avatar
🎯
Focusing

Davit Khaburdzania davit-khaburdzania

🎯
Focusing
View GitHub Profile
@davit-khaburdzania
davit-khaburdzania / candy_widget.js
Last active February 19, 2024 15:42
candy widget
const candyCharacters = {
"emi": {
name: "Emi",
image: "https://i.imgur.com/BYC1iWI.jpeg",
age: "18",
description: "I'm a shy Japanese schoolgirl, I love reading mangas",
url: "https://candy.ai/conversations/emi-kagawa",
cta_text: "CHAT WITH ME",
timeout: 3,
},
@davit-khaburdzania
davit-khaburdzania / string_helper_test.exs
Last active January 6, 2022 12:18
Rails titleize method port to Phoenix
defmodule MyApp.StringHelperTest do
use MyApp.DataCase
alias MyApp.StringHelpers
describe "titleize/1 with valid string input" do
test "returns titleized version of string" do
assert "Man From The Boondocks" == StringHelpers.titleize("man from the boondocks")
assert "The Man Without A Past" == StringHelpers.titleize("TheManWithoutAPast")
assert "Raiders Of The Lost Ark" == StringHelpers.titleize("raiders_of_the_lost_ark")
[
["Italia", "Italia"],
["Georgia", "Georgia"],
["Italia", "Italia"],
["Italia", "Italia"],
["Italia", "Italia"],
["Italia", "Italia"],
["Italia", "Italia"],
["Italia", "Italia"],
["Italia", "Italia"],
@davit-khaburdzania
davit-khaburdzania / addresses.csv
Created February 17, 2021 10:23
addresses csv
Stem Serle - Withdrawal Center Via XXV Aprile, 20, 25080 Serle
Stem San Zeno Naviglio - Withdrawal Center Via Roma, 26, 25010 San Zeno Naviglio
class Tag < ApplicationRecord
has_many :taggings
has_many :posts, through: :taggings
end
class PostsController < ApplicationController
def index
params[:tag] ? @posts = Post.tagged_with(params[:tag]) : @posts = Post.all
end
def show
@post = Post.find(params[:id])
end
def new
@davit-khaburdzania
davit-khaburdzania / TagSelect.js
Created April 25, 2019 13:16
ReactSelect solution
// Actual Component code
import React from "react"
import PropTypes from "prop-types"
import ReactSelect from 'react-select'
class TagSelect extends React.Component {
state = {
selectedOption: null,
}
handleChange = (selectedOption) => {
run.config:
engine: elixir
dev_packages:
- inotify-tools
extra_packages:
- nodejs
fs_watch: true
cache_dirs:
- assets/node_modules
extra_path_dirs:
import { Socket, Presence } from './Phoenix'
const TIMEOUT = 10000
const URL = 'ws://localhost:4000/socket'
const ROOM = 'user_chats:13'
export default (user, onChat) => {
// construct a socket
console.time('connection to socket');
const socket = new Socket(URL, { params: { token: "V3RGTm9GbjRFdFRldzE4QzNRSU9UUT09" }})
import React, { Component } from 'react'
import { AsyncStorage } from 'react-native'
import request from 'axios'
import { NavigationProvider, StackNavigation } from '@exponent/ex-navigation'
import { connect } from 'react-redux'
import Router from 'app/routes'
import { UserActions } from 'app/store/actions'
import { UserSelectors } from 'app/store/selectors'
let connectProps = {...UserActions}