Skip to content

Instantly share code, notes, and snippets.

View ekinertac's full-sized avatar
🥳

Ekin Ertaç ekinertac

🥳
View GitHub Profile
@intaxwashere
intaxwashere / YourProjectEditorModule.cpp
Last active April 9, 2024 00:28
Automatically adding category sections to editor
// add this code to your StartupModule() function of your EDITOR module
// if it doesnt work, try setting loading phase to "postdefault" -- no idea if this will produce side effects though.
// basically idea is looping all CDOs (i.e. UClasses) and their properties, getting their "category" meta value and registering them to
// property sections
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
static constexpr bool bAddSubcategories = false; // you probably want this to be false
auto ProcessCategory = [&PropertyModule](const FName ClassName, const FString& Category)
@camargo
camargo / RubiksCube.md
Last active March 11, 2024 04:01
Solving a Rubik's Cube

Solving a Rubik's Cube

Steps taken from How to Solve a Rubik's Cube | WIRED.

  1. Make the daisy
  2. Create the white cross
  3. Solve the first layer
  4. Solve the second layer
  5. Create the yellow cross:
    • F U R U' R' F'
@rbw
rbw / part_of_day.py
Last active October 17, 2022 22:44
Get part of day (morning, afternoon, evening, night) in Python3.6+
#!/usr/bin/env python3
def get_part_of_day(h):
return (
"morning"
if 5 <= h <= 11
else "afternoon"
if 12 <= h <= 17
else "evening"
@wronk
wronk / python_environment_setup.md
Last active November 27, 2023 16:18
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview of Python Virtual Environments

This guide is targetted at intermediate or expert users who want low-level control over their Python environments.

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. This helps keep each workflow in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. The guide here covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda). See the Using the workflow section to view the end result.


h/t @sharkinsspatial for linking me to the perfect cartoon

@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active April 22, 2024 17:49
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@brock
brock / psql-with-gzip-cheatsheet.sh
Last active April 10, 2024 10:53
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active December 12, 2023 17:47
Destroy all Docker Containers and Images
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@Vestride
Vestride / encoding-video.md
Last active April 24, 2024 09:59
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus

Build a scalable Twitter clone with Django and GetStream.io

In this tutorial we are going to build a Twitter clone using Django and GetStream.io, a hosted API for newsfeed development.

We will show you how easy is to power your newsfeeds with GetStream.io. For brevity we leave out some basic Django-specific code and recommend you refer you to the Github project for the complete runnable source code. At the end of this tutorial we will have a Django app with a profile feed, a timeline feed, support for following users, hashtags and mentions.

I assume that you are familiar with Django. If you're new to Django the [official tutorial] (https://docs.djangoproject.com/en/2.0/intro/) explains it very well.

@ugurozpinar
ugurozpinar / turkce_siralama.js
Created March 21, 2014 09:36
Javascript object array Turkish sorting. Türkçe Sıralama
var arr = [{id:3,title:"Ali"},{id:3,title:"Veli"},{id:3,title:"Vehbi"}];
arr.sort(turkcesiralama);
function turkcesiralama(a, b){
var atitle = a.title;
var btitle = b.title;
var alfabe = "AaBbCcÇçDdEeFfGgĞğHhIıİiJjKkLlMmNnOoÖöPpQqRrSsŞşTtUuÜüVvWwXxYyZz0123456789";
if (atitle.length === 0 || btitle.length === 0) {
return atitle.length - btitle.length;
}