Skip to content

Instantly share code, notes, and snippets.

View yellowberryHN's full-sized avatar
🖐️
i like ya cut g

Zsolt Zitting yellowberryHN

🖐️
i like ya cut g
View GitHub Profile
@statico
statico / gpu.cpp
Last active January 25, 2024 01:06
Trick to tell AMD and Nvidia drivers to use the most powerful GPU instead of a lower-performance (such as integrated) GPU
#ifdef _WIN32
// Use discrete GPU by default.
extern "C" {
// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
// http://developer.amd.com/community/blog/2015/10/02/amd-enduro-system-for-developers/
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif
@phaedryx
phaedryx / chaos.rb
Last active December 21, 2022 23:10
errors = [
SystemStackError, LocalJumpError, IOError, RegexpError, ZeroDivisionError,
ThreadError, SystemCallError, SecurityError, RuntimeError, NameError,
RangeError, IndexError, ArgumentError, TypeError
]
module Kernel
def suppress_warnings
original_verbosity = $VERBOSE
$VERBOSE = nil
@cdmwebs
cdmwebs / friendly_urls.markdown
Created September 11, 2011 15:50 — forked from jcasimir/friendly_urls.markdown
Friendly URLs in Rails

Friendly URLs

By default, Rails applications build URLs based on the primary key -- the id column from the database. Imagine we have a Person model and associated controller. We have a person record for Bob Martin that has id number 6. The URL for his show page would be:

/people/6

But, for aesthetic or SEO purposes, we want Bob's name in the URL. The last segment, the 6 here, is called the "slug". Let's look at a few ways to implement better slugs.