Skip to content

Instantly share code, notes, and snippets.

View vcostin's full-sized avatar

Vadim Costin vcostin

  • Chisinau, Moldova
View GitHub Profile
@vcostin
vcostin / cors_dev_middleware.go
Last active May 27, 2019 12:35
GO http CORS middleware
package middleware
import (
"net/http"
)
// Cors hello
func Cors(next http.Handler) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
@vcostin
vcostin / arrayIndexSearch.js
Last active November 21, 2016 13:08
arrayIndexSearch
var getIndex = function(arr, verify) {
for (var i = 0; i < arr.length; i++) {
if (verify(arr[i])) {
return i;
}
}
return -1;
};
//var index = getIndex(notesCache.items, function (element) {
@vcostin
vcostin / .vimrc
Last active March 22, 2016 23:28
vim conficuration
set nocompatible " be iMproved, required
so ~/.vim/plugins.vim
syntax enable
set backspace=indent,eol,start
let mapleader = ','
set number
@vcostin
vcostin / url_content_iterate.rb
Created April 30, 2015 09:10
openproject plugin file generator
#!/usr/bin/ruby
# url_content_iterate.rb
require 'open-uri'
#https://gist.github.com/myabc/7905820e99914c2acdf8#file-list-of-plugins
REMOTE_URL = 'https://gist.githubusercontent.com/myabc/7905820e99914c2acdf8/raw/4b0f8da8ff8462c824f155b1b3f04ed36ff8e661/List%20of%20plugins'
LOCAL_FILE = './plugin_list.txt'
LOCAL_PLUGIN_GENERATOR = 'plugin_generator.plugin'