Skip to content

Instantly share code, notes, and snippets.

View nicubarbaros's full-sized avatar
🧔‍♂️

Nicu Barbaros nicubarbaros

🧔‍♂️
View GitHub Profile
@nicubarbaros
nicubarbaros / _contact_popup.html.haml
Last active February 24, 2017 21:21
Ajaxify your site with remote => true and respond_to block into an pop up modal
= form_for :contact_us, url: contact_board_path, id: 'contact--form', remote: true do |f|
.form--section-content
= f.label :name_surname
= f.text_field :name_surname, required: true
.form--section-content
= f.label :email
= f.text_field :email, required: true, type: 'email'
.form--section-content
= f.label :message
= f.text_area :message, required: true
@nicubarbaros
nicubarbaros / .bash
Created April 16, 2017 20:22
A list of plugins and loaders for REACT
npm install --save-dev babel-core babel-loader babel-preset-env babel-preset-react css-loader style-loader html-webpack-plugin webpack webpack-dev-server
@nicubarbaros
nicubarbaros / index.html
Created April 17, 2017 14:12
Basic html for React apps
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Github Batle</title>
</head>
<body>
<div id="app"></div>
</body>
@nicubarbaros
nicubarbaros / index.css
Created April 17, 2017 17:49
Fonts that are on user computer, will be rendered depending on the OS. This way we don't need to load any other external fonts.
body {
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif;
}
@nicubarbaros
nicubarbaros / fonts.css
Created May 24, 2017 19:57
System fonts
body {
font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Roboto, Helvetica, Arial, sans-serif;
font-size: 16px/1.2;
}
@nicubarbaros
nicubarbaros / gist:9a609d2f92319b03200a4396a695fda1
Last active June 2, 2017 14:17
One liner to stop / remove all of Docker containers & images:
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# Build image from DOCKERFILE
docker build .
# Create container from image
docker run -dit #{image name:key}
# Create docker machine
docker-machine create --driver virtualbox default
@nicubarbaros
nicubarbaros / .bash
Created June 20, 2017 07:54
Start tornado server with configuration file
python main.py --config-file=config/dev.py server
@nicubarbaros
nicubarbaros / mentions.js
Created April 17, 2018 21:13
Draft Js Mentions
import { convertFromRaw, convertToRaw, ContentState } from 'draft-js';
const getIndicesOf = (searchStr, str, caseSensitive) => {
let tempStr = str;
let tempSearchStr = searchStr;
const searchStrLen = tempSearchStr.length;
if (searchStrLen === 0) {
return [];
}
let startIndex = 0;
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var domStyle = document.createElement("style");
domStyle.append(
'* { color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\
* * { background-color: rgba(0,255,0,.2) !important; }\
* * * { background-color: rgba(0,0,255,.2) !important; }\
* * * * { background-color: rgba(255,0,255,.2) !important; }\
* * * * * { background-color: rgba(0,255,255,.2) !important; }\