Skip to content

Instantly share code, notes, and snippets.

https://www.ximedes.com/test-redux-action-creators-with-jest/
@netologist
netologist / photos-date-changer.sh
Last active May 18, 2017 06:36
photos-date-changer.sh
#!/bin/bash
for folder in */ ; do
d1=${folder%%_*}
for file in "$folder"*; do
echo "$file"
if [[ $file =~ \.(avi|AVI|mpeg|mpg|mov|wmv|mp4)$ ]]; then
datestr=${d1//' '/'-'}
f=${file%%.*};
#!/bin/sh
if [ "$1" == "" ]; then
echo "Usage: $0 <PROJECT_ROOT> <GITHUB_REPO>"
exit 1
fi
if [ "$2" == "" ]; then
echo "Usage: $0 <PROJECT_ROOT> <GITHUB_REPO>"
exit 1
fi
package main
import (
"fmt"
"regexp"
)
// Turkish Alpabetic Numeric "(),\-./"
func IsAlphaNumeric(text string) (ok bool) {
ok, _ = regexp.MatchString("^([\\(\\)\\,\\\\\\-\\./ a-zA-ZğüşıöçĞÜŞİÖÇ0-9]+)$", text)
const items = [1,52,14,54,[10,1,3,5],14,6];
const flatten = (arr) => {
const flat = [].concat(...arr)
return flat.some(Array.isArray) ? flatten(flat) : flat;
}
const splitAt = (arr, predicate) => {
var selected = [];
var others = [];
@netologist
netologist / nginx.conf
Created March 13, 2016 11:52 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@netologist
netologist / Makefile
Created December 29, 2015 21:00 — forked from border/Makefile
json example in golang
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go
@netologist
netologist / gist:93b35f0c8ab5c96f44d0
Created November 26, 2015 15:38 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
/* This is intentionally blank just and exists to secure a decent gist name */
@netologist
netologist / total-time-calculator.js
Created February 12, 2015 10:26
udemy get course total time
function toSeconds( time ) {
var parts = time.split(':');
return (+parts[0]) * 60 * 60 + (+parts[1]) * 60 + (+parts[2]);
}
function toHHMMSS(sec) {
var sec_num = parseInt(sec, 10); // don't forget the second parm
var hours = Math.floor(sec_num / 3600);
var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
var seconds = sec_num - (hours * 3600) - (minutes * 60);