Popular bash commands in PowerShell:
grep: Select-String
Select-String -r "console" .\foo\**\*.js
cat: Get-Content
Get-Content foo.md
" Use |:RubocopAutocorrect[!]| to autocorrect the current file using Rubocop. | |
" Note that this will save the file before running the autocorrects. If ! is | |
" given, it will use unsafe autocorrects. | |
augroup ruby | |
autocmd! | |
autocmd FileType ruby command! -bang RubocopAutocorrect silent! call RubyRubocopAutocorrect(expand('<bang>') == '!')<CR> | |
augroup END | |
function! RubyRubocopAutocorrect(unsafe) abort | |
let flag = a:unsafe ? '-A' : '-a' |
type tBlinkTween | |
tweens as integer[] | |
chain as integer | |
endtype | |
function BlinkTween_Create(sprite as integer) | |
blink as tBlinkTween | |
tween1 = CreateTweenSprite(0.5) | |
SetTweenSpriteAlpha(tween1, 255, 128, 0) |
// VARIABLES | |
// no need to specify type | |
a = 1.2 // float | |
name = "Federico" // string | |
// you can still do it if you want | |
x as float | |
x = 1.2 | |
function Double(x as integer) |
App.Lib.GlobalEvents = | |
### | |
This will trigger the callback whenever the user clicks on something outside | |
the given element. If the user clicks on something insied `el`, it will not | |
trigger the callback. | |
You can give it many elements using jQuery's `#add`: | |
$els = $('.my-element').add($('.some-other-element')) | |
App.Lib.GlobalEvents.onClickedOutside $els, => | |
# do something | |
### |
# some model | |
serialize :my_field, Array | |
ransacker :my_field_raw, type: :string do | |
Arel.sql('my_table.my_field') | |
end | |
# some view (using simple form) | |
= search_form_for @q, builder: SimpleForm::FormBuilder do |f| |
# This makes sure UTF8 characters don't break the encoding/decoding. For | |
# more info: https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding | |
# | |
App.Lib.Base64 = | |
encode: (str) -> | |
window.btoa unescape(encodeURIComponent(str)) | |
decode: (str) -> | |
decodeURIComponent escape(window.atob(str)) |
;; a plist associating keywords with functions | |
(defvar *commands* | |
'(:title title-command)) | |
(defun title-command (params) | |
(format t "Title command function. Params: ~A" params)) | |
;; I want to read the keyword from the CLI, but it's a char array | |
;; how can I cast it to keyword? | |
(apply (getf *commands* (read-line)) '(1 2 3)) |
Common Lisp is a general-purpose programming language with functions as first-class citizens. Don't worry about being purely functional, Lisp is Object Oriented too. CLOS is a very powerful object-oriented system!
The Common Lisp lingo is quite unique: