Skip to content

Instantly share code, notes, and snippets.

View arjankuijpers's full-sized avatar

Arjan Kuijpers arjankuijpers

View GitHub Profile
import Foundation
import AppKit
import AVFoundation
extension NSImage {
@objc var CGImage: CGImage? {
get {
guard let imageData = self.tiffRepresentation else { return nil }
guard let sourceData = CGImageSourceCreateWithData(imageData as CFData, nil) else { return nil }
return CGImageSourceCreateImageAtIndex(sourceData, 0, nil)
@Youka
Youka / lua_myobject.cpp
Last active May 16, 2024 19:59
Example of Lua in C++ and userdata objects
// Lua C API
#include <lua.hpp>
// C++ input/output streams
#include <iostream>
// MyObject as C++ class
class MyObject{
private:
double x;
public:
@komasaru
komasaru / Mysql.cpp
Created August 17, 2014 05:54
C++ source code to connect to MariaDB(MySQL).
/*
* Example to connect to MariaDB(MySQL)
*/
#include <iostream>
#include <mysql/mysql.h> // require libmysqlclient-dev
#include <string>
using namespace std;
/*
@tlinkner
tlinkner / Output iOS Icons.jsx
Last active March 21, 2019 18:06
Photoshop script to output iOS icons, now with iOS 8 sizes
// Output iOS Icons.jsx
// 2014 Todd Linkner
// License: none (public domain)
// v1.2
//
// This script is for Photoshop CS6. It outputs iOS icons of the following
// sizes from a source 1024px x 1024px PSD
//
// [name]-29.png
// [name]-29@2x.png
@perky
perky / ProFi.lua
Created May 30, 2012 20:32
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
@adrienne
adrienne / NerderyVPN.bat
Created May 23, 2012 09:39
A batch file to connect to the VPN and mount the network storage as a drive
@echo off
if exist n:\home goto DISCONNECTME else goto CONNECTME
:CONNECTME
REM NOTE: in all of the below variables EXCEPT for mydrivename , double-quote the values!
REM This is the name of the VPN you've got set up
set myvpnname="Name of your VPN connection"