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
<%= turbo_frame_tag "new_message", target: "_top" do %> | |
<%= form_with(model: [@message.room, @message], data: { controller: "reset-form", action: "turbo:submit-end->reset-form#reset" }) do |form| %> | |
<%= form.text_field :content, autocomplete: 'off', placeholder: 'Write your message...' %> | |
<%= button_tag(type: :submit) do %> | |
<i class="fa fa-paper-plane" aria-hidden="true"></i> | |
<% end %> | |
<%= form.submit "Send", data: {disable_with: false} %> | |
<% end %> | |
<% 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
2020 Simple solution without rebase : | |
git reset --soft HEAD~2 | |
git commit -m "new commit message" | |
git push --force | |
2 means the last two commits will be squashed. You can replace it by any number |
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
[ | |
{ | |
"name": "Adana", | |
"borders": [ | |
"Hatay", | |
"Osmaniye", | |
"Kahramanmaraş", | |
"Kayseri", | |
"Niğde", | |
"Mersin" |
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
git update-index --assume-unchanged [<file> ...] | |
To undo and start tracking again: | |
git update-index --no-assume-unchanged [<file> ...] |
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
# It shows if tab seperated file has any error, and print line number | |
# filename = "tab_file.txt" | |
with open(filename) as f: | |
i = 0 | |
for line in f: | |
line = line.rstrip() | |
i = i + 1 | |
if line: | |
try: | |
word, tag = line.split('\t') |
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
You want to be using GNU Screen. It is super awesome! | |
ssh me@myserver.com | |
screen #start a screen session | |
run-a-long-process | |
CTRL+a , d to detatch from your screen session | |
exit #disconnect from the server, while run-a-long-process continues | |
When you come back to your laptop: |
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
Use sudo apt-get install screen to install screen. Then run it using screen. Now you have a separate console window which can be detached using Ctrl + A, then D. Closing putty will not end your screen-session. If you log back in at any later point, you may resume the sessions using screen -r. | |
To summarize: | |
> sudo apt-get install screen | |
> screen | |
# pops up a new shell | |
> rails c | |
# run your reindex operation | |
# press Ctrl + A, then D |
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
{"total":200,"completed":3} |
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 Form = t.form.Form; | |
const postOptions = t.struct({ | |
publication: t.String, | |
tags: t.String, | |
more: t.String, | |
facebook: t.Boolean | |
}) | |
const options = { |
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 { takeLatest } from 'redux-saga' | |
import { call, put } from 'redux-saga/effects' | |
import fetch from 'isomorphic-fetch' | |
import * as actions from './modules/grid' | |
import * as api from '../lib/api' | |
export function* fetchGrids(action) { | |
try { | |
const grids = yield call(api.GET, 'grids') | |
yield put(actions.fetchGridsSuccess(grids)) |
NewerOlder