Skip to content

Instantly share code, notes, and snippets.

View NocturnDragon's full-sized avatar

X NocturnDragon

View GitHub Profile
@NocturnDragon
NocturnDragon / Open_safari_tab_in_google_chrome.scpt
Created June 21, 2011 22:09
Open current safari tab in Google Chrome
property storedURL : ""
tell application "Safari"
set storedURL to URL of current tab of front window
end tell
tell application "Google Chrome"
try
set URL of active tab of front window to storedURL
on error
make new window
set URL of active tab of front window to storedURL
@NocturnDragon
NocturnDragon / computable_include.h
Created June 27, 2011 17:21
Computable Include
////////////////////////////////////////////////////////////
// <License>
////////////////////////////////////////////////////////////
#pragma once
////////////////////////////////////////////////////////////
// Title: Computable Include
////////////////////////////////////////////////////////////
#
# © 2011 Christopher Arndt, MIT License
#
# Taken from: http://wiki.python.org/moin/PythonDecoratorLibrary
import time
class cached_property(object):
'''Decorator for read-only properties evaluated only once within TTL period.
class FileWatcher
{
public:
FileWatcher(const Path& path)
: m_Path(path)
, m_DirHandle(INVALID_HANDLE_VALUE)
, m_BufferSize(CORE_KB(100))
, m_Buffer(nullptr)
, m_ChangedFiles(1024)
{
@NocturnDragon
NocturnDragon / PCG.md
Last active August 29, 2015 14:25 — forked from mrcasals/PCG_AI.md
PCG interesting links - nucl.ai

If you want to add links here, leave a comment or ping me by Twitter or GitHub (@mrcasals on both platforms). You can find my email in my GitHub profile too!

Books

Talks & Conference-related stuff

// Simple color picker by @rianflo
// http://twitter.com/rianflo
// public domain
#ifdef GL_ES
precision highp float;
#endif
uniform float time;
@NocturnDragon
NocturnDragon / Swizzles.h
Last active October 15, 2023 01:20
Swizzles in Clang, GCC, and Visual c++
#include <stdio.h>
// #define CLANG_EXTENSION
// Clang compile with -O3
#define VS_EXTENSION
// https://godbolt.org/z/sVWrF4
// Clang compile with -O3 -fms-compatibility
// VS2017 compile with /O3
@NocturnDragon
NocturnDragon / ClCrash.cpp
Created October 7, 2016 13:59
Cl Internal Compiler Error
// Command line a simple
// cl ClCrash.cpp
struct foo
{
float x;
float y;
__declspec(property(get = get_x)) foo xx;
@NocturnDragon
NocturnDragon / Jinja module loader.md
Created February 15, 2017 22:45 — forked from voscausa/Jinja module loader.md
Jinja2 compiled templates module loader for App Engine Pyhton 2.7.

Jinja compiled templates module loader

This code is part of a Jinja CMS for Google App Engine Python 2.7 and NDB datastore

A Jinja enviroment is created for every CMS site: site_key_id = 'example

The modules are created using compiler.py The resulting code objects are stored in the dadastore using Kind Runtimes and a BlobProperty

The modules can also be saved / downloaded as .pyc in a zip archive: -compiled-templates.zip

// File: pjson.h - written by Rich Geldreich 2012 - License: Unlicense http://unlicense.org/
#ifndef PURPLE_JSON_H
#define PURPLE_JSON_H
#ifdef WIN32
#pragma once
#endif
#include <string>
#include <vector>