Skip to content

Instantly share code, notes, and snippets.

View erikccoder's full-sized avatar

erik-joeng erikccoder

View GitHub Profile
ffmpeg -i "%1" -vcodec copy -acodec pcm_s16le -ac 2 "%1.mov"
@erikccoder
erikccoder / gl_fbo_alpha_drawing
Last active August 29, 2015 14:03
OpenGL accumulate alpha drawing in FBO
glEnable(GL_BLEND);
//glBlendFuncSeparate(GL_ONE, GL_SRC_COLOR, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBlendFuncSeparate(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA,GL_ONE,GL_ONE_MINUS_SRC_ALPHA);
//draw
glDisable(GL_BLEND);
@erikccoder
erikccoder / drawSkew.cpp
Created February 25, 2014 03:49
draw Skew
void testApp::drawSkew(ofImage * src, ofPoint * tl, ofPoint * tr, ofPoint * br, ofPoint * bl) {
// tl,tr,br,bl = normalized 0.-1.
ofSetColor(255);
src->reloadTexture();
//src->draw(0,0);
//ofDisableArbTex();
src->getTextureReference().bind();
// glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
glPushMatrix();
@erikccoder
erikccoder / disable_bubbling_up_scrolling.js
Created October 17, 2013 06:07
disable touch scrolling bubbling up DOM
//http://stackoverflow.com/questions/16889447/prevent-full-page-scrolling-ios
elem.addEventListener('touchstart', function(event){
this.allowUp = (this.scrollTop > 0);
this.allowDown = (this.scrollTop < this.scrollHeight - this.clientHeight);
this.prevTop = null; this.prevBot = null;
this.lastY = event.pageY;
});
elem.addEventListener('touchmove', function(event){
@erikccoder
erikccoder / ffmpeg.sh
Last active January 27, 2016 01:28
ffmpeg to html5 video.
http://johndyer.name/ffmpeg-settings-for-html5-codecs-h264mp4-theoraogg-vp8webm/
REM mp4 (H.264 / ACC)
ffmpeg -i %1 -b 1500k -vcodec libx264 -vpre slow -vpre baseline -g 30 -s 640x360 %1.mp4
REM webm (VP8 / Vorbis)
ffmpeg -i %1 -b 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 -s 640x360 %1.webm
REM ogv (Theora / Vorbis)
ffmpeg -i %1 -b 1500k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30 -s 640x360 %1.ogv
REM jpeg (screenshot at 10 seconds)
ffmpeg -i %1 -ss 00:10 -vframes 1 -r 1 -s 640x360 -f image2 %1.jpg
@erikccoder
erikccoder / remove_editor.php
Created May 10, 2013 05:07
wordpress remove editor
/*
Disable content editor for specific page template
*/
add_action('admin_init', 'hide_editor');
function hide_editor() {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
if (!isset($post_id)) return;
$template_file = get_post_meta($post_id, '_wp_page_template', true);
@erikccoder
erikccoder / add_meta_box_in_posts.php
Created May 10, 2013 04:57
wordpress add meta box in edit post page.
/**
add custome meta box.
* Calls the class on the post edit screen
*/
function call_someClass()
{
return new someClass();
}
if ( is_admin() )
add_action( 'load-post.php', 'call_someClass' );
@erikccoder
erikccoder / add_custom_admin_page.php
Created May 10, 2013 04:55
wordpress add custom admin page with data submit and receive.
/*
add custom admin page;
http://codex.wordpress.org/Function_Reference/add_menu_page
*/
add_action( 'admin_menu', 'register_my_custom_menu_page' );
function register_my_custom_menu_page(){
/*
args:
$page_title,
@erikccoder
erikccoder / add_tag_into_setting.php
Last active December 17, 2015 04:39
wordpress add tag / sub menu / into setting menu
/*
add custom admin setting tag & content;
http://codex.wordpress.org/Administration_Menus
*/
/** Step 2 (from text above). */
add_action( 'admin_menu', 'my_plugin_menu' );
/** Step 1. */
function my_plugin_menu() {
add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );
@erikccoder
erikccoder / add_role_capability.php
Created May 10, 2013 04:50
wordpress add custom role and capability
// add custom role & capability
add_action('admin_init', 'add_custom_role');
function add_custom_role()
{
$marketing = add_role('marketing',
'Marketing',
array(
'read' => true,
'manage_links',