PostgreSQL Type | PostgreSQL Size | Description | Range | Diesel Type | Rust Type |
---|---|---|---|---|---|
Nullable Types | nullable | Nullable `` |
class LRUCache | |
attr_reader :dll, :hash, :count, :capacity | |
def initialize(capacity) | |
@dll = DLL.new | |
@hash = Hash.new | |
@count = 0 | |
@capacity = capacity | |
end | |
def read(key) |
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
copy/delete word under cursor in Vim | |
yw / byw | |
Assuming that the cursor is at the first character of the word simply do this in command mode: | |
yw | |
y is for yank and w is for word. | |
Other ways of doing the same thing which are not as efficient: | |
vey | |
the v starts visual select mode. e tells vim to move to end of word. y yanks or copies the word. to delete replace y with x. |
brew tap homebrew/cask-fonts | |
brew install --cask font-cascadia-code | |
brew install --cask font-cascadia-code-pl | |
brew install --cask font-cascadia-mono | |
brew install --cask font-cascadia-mono-pl |
# Update Neovim to latest from master | |
# https://github.com/neovim/neovim/commits/master | |
# You should have the Neovim repo cloned | |
upnvim() { | |
cd ~/vim-dev/sources/neovim # change to your local repo | |
git pull | |
make distclean | |
make CMAKE_BUILD_TYPE=RelWithDebInfo -j4 # Fast with Debug info. Not quite Release fast. | |
sleep 10 # You don't need this but I have my reasons :-) | |
sudo make install |
When [Markdown][markdown] appeared more than 10 years ago, it aimed to make it easier to express ideas in an easy-to-write plain text format. It offers a simple syntax that takes the writer focus away from the formatting, thus giving her time to focus on the actual content.
The market abunds of editors to be used for help with markdown. After a few attempts, I settled to Sublime and its browser preview plugin, which work great for me and have a small memory footprint to accomplish that. To pass the results around to other people, less technical, a markdown file and a bunch of images is not the best approach, so converting it to a more robust format like PDF seems like a much better choice.
[Pandoc][pandoc] is the swiss-army knife of converting documents between various formats. While being able to deal with heavy-weight formats like docx and epub, we will need it for the more lightweight markdown. To be able to generate PDF files, we need LaTeX. On OSX, the s
function GregToHijri(arg) { | |
console.log ( 'arg' ); | |
console.log (arg); | |
if(arg == ""){ | |
return ""; | |
} | |
//declare a date format year,month,day sequence | |
var arabic_date = new Array(0,0,0); |