Skip to content

Instantly share code, notes, and snippets.

View mfyz's full-sized avatar
✌️

Mehmet Fatih Yıldız mfyz

✌️
View GitHub Profile
@mfyz
mfyz / custom function.php and inline.php
Created June 12, 2020 17:39
wordpress custom excerpt
<?
function new_excerpt_more( $more ) { return '...'; }
add_filter('excerpt_more', 'new_excerpt_more');
$content = get_the_excerpt();
if (!$content) {
$content = get_the_content();
if (strlen($content) > 150) {
@mfyz
mfyz / HTML_Content_From_gSheet.html
Created April 14, 2020 02:14
Google Sheets to HTML
<style>
body {
font: 16px/24px Helvetica, Sans-Serif;
padding: 30px;
}
</style>
<script
src="https://code.jquery.com/jquery-2.2.4.min.js"
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
@mfyz
mfyz / AccessGoogleSheetViaPublicJSON.md
Last active April 10, 2020 05:08
Access Google Sheet via Public JSON
@mfyz
mfyz / get-password.sh
Last active March 12, 2020 18:22
Get password from macOS keychain in command line
# First save the password in keychain as new password and give it a name
security -q find-generic-password -a __CURRENT_USERNAME__ -s __PASSWORD_NAME__ -w
@mfyz
mfyz / terminal-colors.sh
Created February 25, 2020 14:20
terminal-colors.sh (this is how it looks like: https://d.pr/free/i/Ovrwza)
echo "----- BG COLORS -----"
echo "\033[40m BLACK BG \033[0m"
echo "\033[41m RED BG \033[0m"
echo "\033[42m GREEN BG \033[0m"
echo "\033[43m YELLOW BG \033[0m"
echo "\033[44m BLUE BG \033[0m"
echo "\033[45m MAGENTA BG \033[0m"
echo "\033[46m CYAN BG \033[0m"
echo "\033[47m LIGHT_GRAY BG \033[0m"
@mfyz
mfyz / AppDelegate.swift
Last active January 14, 2020 22:48
Bare bones swift iOS app (without storyboard and scenes)
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
let homeViewController = UIViewController()
@mfyz
mfyz / gapp.js
Created January 13, 2020 19:26
Auto Increment (Sequence) in Google Sheets / Google Apps Script
function onEdit(e) {
// Auto increment number column name
var aiColumnName = 'A';
// The column that is tested, seq numbers will be
// given if this column is not empty.
var requieredColName = 'B'
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var worksheet = spreadsheet.getActiveSheet();
var aiColRange = worksheet.getRange(aiColumnName + '1:' + aiColumnName + '1000');
@mfyz
mfyz / profile.json
Created January 2, 2020 06:50
Example well structured json
{
"first_name": "Sammy",
"last_name": "Shark",
"location": "Ocean",
"social_media": [
{
"description": "twitter",
"link": "https://twitter.com/digitalocean"
},
{
@mfyz
mfyz / xpath-validate.js
Created December 23, 2019 21:36
evaluate xpath on browser/dom (console)
var xpath = "//a[contains(@href,'/slack') and contains(text(), 'Skip for now')]"
var result = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE, null);
result.iterateNext()
@mfyz
mfyz / changelog-sample
Last active November 19, 2019 19:17
changelog-sample.md
## [Unreleased]
### Changed
- tray menu link for update to website, instead of github
- Chinese (Taiwan) translations updated
- German translations updated
- no notification is shown after system resume/unlock
- no notification is shown after manual resume of pause from tray menu
### Added
- pause breaks when screen is locked (Windows, macOS)