Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View csarigoz's full-sized avatar

Cagri Sarigoz csarigoz

View GitHub Profile
@csarigoz
csarigoz / youtube_video_responsive_embed_example.html
Last active February 1, 2024 18:02
YouTube Video Responsive Embed Example
<div class="video-container">
<iframe src="https://www.youtube.com/embed/TcNaihIowlo?cc_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;iv_load_policy=3" frameborder="0" allowfullscreen=""></iframe>
</div>
@csarigoz
csarigoz / thumbnail-in-rss-feed.php
Last active November 20, 2023 07:54
Add thumbnail image of posts to WordPress RSS Feed -> Add to functions.php file of your theme
// Add namespace for media:image element used below
add_filter( 'rss2_ns', function(){
echo 'xmlns:media="http://search.yahoo.com/mrss/"';
});
// insert the image object into the RSS item
add_action('rss2_item', function(){
global $post;
if (has_post_thumbnail($post->ID)){
$thumbnail_ID = get_post_thumbnail_id($post->ID);
@csarigoz
csarigoz / google-sheet-link_url.gs
Last active April 5, 2023 13:31
Google sheet custom function that returns the URL of a hyperlinked cell, if it's entered with hyperlink command.
@csarigoz
csarigoz / gist:cde2a4e2d8e684d042ffd5666aee0b8f
Created April 3, 2023 13:29
Google sheet custom formula to filter a column on pivot table by REGEXMATCH
=REGEXMATCH(TOP_PEOPLE,"cagri|cargri|cargi")
@csarigoz
csarigoz / filter_list_dict_key.py
Created July 4, 2022 16:06
Filter a List of Dictionaries By Key
users = [{'username': 'alice', 'age': 23, 'play_time': 101},
{'username': 'bob', 'age': 31, 'play_time': 88},
{'username': 'ann', 'age': 25},]
superplayers = [user for user in users if 'play_time' in user]
print(superplayers)
# resource: https://blog.finxter.com/how-to-filter-a-list-of-dictionaries-in-python/
var key = "YOUR_API_KEY";
@csarigoz
csarigoz / run_exe_file_in_wine
Created March 8, 2016 08:24
Applescript for Running an exe file in wine
#open gemius explorer
tell application "Terminal"
do script "/usr/local/bin/wine ~/.wine/drive_c/Program\\ Files/Gemius/gemiusExplorer/gemiusExplorer.exe"
end tell
@csarigoz
csarigoz / Hello Analytics.py
Created August 20, 2015 05:20
Hello Analytics for python 3 (with converting p12 secrets file to pem)
"""A simple example of how to access the Google Analytics API."""
import argparse
from apiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials
import httplib2
from oauth2client import client
from oauth2client import file
@csarigoz
csarigoz / karatsuba.py
Created July 15, 2015 03:49
Karatsuba Algortihm for Integer Multiplication
from random import randint
def karatsuba(x, y):
if (x<10) or (y<10):
return x*y
x_str = str(x)
x_n = len(x_str)
y_str = str(y)
y_n = len(y_str)
@csarigoz
csarigoz / recursive_multiplication.py
Last active August 29, 2015 14:24
A Basic Recursive Integer Multiplication Algorithm
from random import randint
def recursive_mult(x, y):
if (x<10) or (y<10):
return x*y
x_str = str(x)
x_n = len(x_str)
y_str = str(y)
y_n = len(y_str)