Skip to content

Instantly share code, notes, and snippets.

View Akira-Hayasaka's full-sized avatar
🏠
Working from home

Akira Hayasaka Akira-Hayasaka

🏠
Working from home
View GitHub Profile
@Akira-Hayasaka
Akira-Hayasaka / gist:ff1e9c92f62a911c11e5
Last active August 29, 2015 14:08
add event to superclass's function via subclass instance
ofAddListener(someEvent, static_cast<SuperClass*>(&subClass), &SuperClass::foo);
sampler2D : normalized texture coordinates (0..1, 0..1)
sampler2DRect : unnormalized texture coordinates (0..w, 0..h)
@Akira-Hayasaka
Akira-Hayasaka / gist:e98508bc47915ec24cfc
Last active August 29, 2015 14:17
recursive dir scan
void FileSync::scanAllFile(ofDirectory dir, vector<string>* filelist)
{
dir.sort();
for (int i = 0; i < dir.size(); i++)
{
if (dir.getFile(i).isDirectory())
{
ofDirectory newDir;
newDir.open(dir.getFile(i).getAbsolutePath());
newDir.listDir();
struct tm* ofApp::getModifiedTimeStruct(string filePath)
{
struct tm* rtn;
struct stat attrib;
stat(filePath.c_str(), &attrib);
rtn = gmtime(&(attrib.st_mtime));
return rtn;
}
bool ofApp::isModified(struct tm* lastSyncTime, struct tm* tgtFileLastModifiedTime)
@Akira-Hayasaka
Akira-Hayasaka / gist:2455e237fe140668b68e
Created April 3, 2015 04:42
invisible background oF app
1. use ofxTransparentWindow to make it invisible https://github.com/jefftimesten/ofxTransparentWindow
2. on openFrameworks-Info.plist
- set "Application is background only”(LSBackgroundOnly) to "YES" to make it always background
afp://Makira%20%E3%81%AE%20iMac._afpovertcp._tcp.local
tell application "Finder"
mount volume "smb://makira:doraemon@192.168.0.3/makira"
end tell
tell application "Finder"
mount volume "afp://Makira%20%E3%81%AE%20iMac._afpovertcp._tcp.local/makira"
end tell
@Akira-Hayasaka
Akira-Hayasaka / gist:86bc0be4bdb16759a883
Last active August 29, 2015 14:18
make sure the volume is mounted
//
// VolumeMounter.h
// ・:,。゚・:,。★゚・:,。゚・:,。☆゚・:,。゚・:,。
//
// Created by Akira on 4/6/15.
//
//
#pragma once
@Akira-Hayasaka
Akira-Hayasaka / gist:ae05d950aadf585982f5
Created June 9, 2015 04:29
random points within a circle
static ofPoint getCircularRdmPos(float pRadius, ofPoint orig, bool bUniDist = false)
{
float angle = ofRandomuf() * PI * 2;
float radius = 0.0;
if (bUniDist)
{
radius = sqrt(ofRandomuf()) * pRadius;
}
else
#pragma include "../common/header.glsl"
#pragma include "../common/defaultVertIn.glsl"
uniform float uAngle;
out VSOUT
{
vec2 texCoord;
} vsout;
@Akira-Hayasaka
Akira-Hayasaka / gist:1164666
Created August 23, 2011 08:37
openGL light
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_BLEND);
glPolygonMode(GL_BACK, GL_FILL );
glEnable(GL_CULL_FACE);