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
from __future__ import print_function | |
import os | |
import datetime | |
for file in os.listdir("."): | |
if os.path.isfile(file) and (file.endswith('ARW') or file.endswith('jpg') or file.endswith('JPG') or file.endswith('xmp')) : | |
stat = os.stat(file) | |
created = stat.st_birthtime | |
dt = datetime.datetime.fromtimestamp(tt) | |
year = d.year |
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
<html lang="en" dir="ltr"> | |
<head> | |
<title>Mat-Typo</title> | |
<meta key="viewport" name="viewport" content="initial-scale=1.0, width=device-width, shrink-to-fit=no" /> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" /> | |
<link rel="stylesheet" href="./styles.css" /> | |
</head> | |
<body> | |
<p class='mat-h4'> Material Design - Typography example</p> | |
<p class="mat-body1"> More information can be found in the documentation under |
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
#!/usr/local/bin/ruby -w | |
puts ( ['A'..'Z'].map(&:to_a) # create field with characters A-Z | |
.flatten - ["F", "T"] # reduce nesting level and exclude 'F' and 'T' | |
)[rand(23)] # take a random value from the remainung 24 letters |
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 branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
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
<?php | |
// A test to determine whether foreach or array_walk is faster | |
$foretimes = 0; | |
for($i=0; $i < 10000; $i++){ | |
$test = array_fill(0, 10000, 'test_data'); | |
$start = microtime(true); |
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
/** | |
* Conditional control structure for ui.router states | |
* | |
* usage in js: | |
* angular.module('myModuel',['ui.router','ui-sref-if') ...... | |
* | |
* usage in view: | |
* <a ui-sref=".nextstate" ui-sref-if="!myForm.$invalid">Next State</a> | |
* | |
* sass: |
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
# PHP / Ruby | |
# Regex find key and value pair in JSON formated string | |
# Match 1: Key | |
# Match 2: Value | |
# https://regex101.com/r/zR2vU9/4 | |
# http://rubular.com/r/KpF3suIL10 | |
# http://stackoverflow.com/questions/14349889/how-to-use-a-regular-expression-to-extract-json-fields/35129815#35129815 | |
(?:\"|\')(?<key>[^"]*)(?:\"|\')(?=:)(?:\:\s*)(?:\"|\')?(?<value>true|false|[0-9a-zA-Z\+\-\,\.\$]*) |
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
/** | |
* Method generates a password | |
* @param int $length length of password | |
* @param int $strength | |
* 0 - Password with random case-sensitive characters and digits (standard set of 64 characters | |
* 1 - Password will be generated of a extended set of 88 characters | |
* @return string the generated password | |
*/ | |
public function generatePassword($length=8, $strength=1) { | |
$password = ''; |
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
//IIFE | |
(function(window, $) { | |
//on document ready | |
$(function() { | |
//Gets A-Elements `href` attr. and add `active`-class to parents LI-Element | |
$('a[href="' + window.location.pathname + '"]').parent("li").addClass('active'); | |
}); | |
})(window, window.jQuery); |