Skip to content

Instantly share code, notes, and snippets.

View bibhas's full-sized avatar

Bibhas Acharya bibhas

  • Kathmandu, Nepal
View GitHub Profile
var r = Raphael(0, 0, 400, 600),
aRect = r.rect(10, 10, 100, 100),
aPath = r.path('M10,200 l100,0 l0,100 l-100,0 z'),
aText = r.text(200, 150, "Double click on the boxes to see what I mean.");
aRect.attr({'fill':'url("http://commondatastorage.googleapis.com/proto4/beltpattern4.png")'});
aPath.attr({'fill':'url("http://commondatastorage.googleapis.com/proto4/beltpattern4.png")'});
aRect.dblclick(function() {
this.animate({'translation':"100, 0"}, 1000);
@bibhas
bibhas / hello-world.cpp
Last active September 1, 2016 06:43
For Bidit
#include <iostream>
void funcWithReference(int &ref)
{
ref = 659;
}
void funcWithPtr(int *ptr)
{
*ptr = 659; // ignore this
@bibhas
bibhas / Intro
Last active July 10, 2017 05:41
LLDB C++ API function tracer
Scroll to the bottom for the code (tracer.mm)
When I run the tracer, the return value (the value of rax after stepping out of the thread) is always zero.
I'm breaking on malloc, so the output should be some pointery looking value. I tried with other functions as well,
and I get the same issue. I also tried checking for the process state, and that says it's invalid.
@bibhas
bibhas / OpenGLToCVPixelBuffer.m
Created July 13, 2017 14:00 — forked from caojianhua/OpenGLToCVPixelBuffer.m
Create CVPixelBufferRef from OpenGL
@interface SREAGLContext : NSObject
+ (EAGLContext*)sharedContext;
+ (EAGLContext*)newContext: (EAGLRenderingAPI) api;
@end
@implementation SREAGLContext
@bibhas
bibhas / CGSPrivate.h
Created August 12, 2017 05:44 — forked from rjw57/CGSPrivate.h
CGSPrivate.h - undocumented APIs for OSX. Re-licensed under MIT licence.
/* CGSPrivate.h -- Header file for undocumented CoreGraphics stuff. */
/* This file is a relicensed portion of DesktopManager and was originally released under
* the terms of the GNU General Public Licence. Original licence text follows the new terms.
* The contents of this file has been re-released by the original author under the following terms:
*
* Copyright (C) 2003, 2004, 2013 Richard J Wareham <richwareham@users.sourceforge.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
@bibhas
bibhas / libyuv.cc
Created November 11, 2017 09:56 — forked from zintus/libyuv.cc
Update CVImageBufferRef with pixels in capture format with bgra pixels using libyuv
// Function to update image buffer in NV12 format with BGRA pixel buffer
// Assumptions:
// bgra buffer is 32bpp
// bgra buffer width and height equal to imageBuffer
// bgra buffer stride is equal to imageBuffer width
int UpdateSampleBufferWithBGRAPixels(CVImageBufferRef imageBuffer, void *bgraPixels) {
const OSType pixelFormat = CVPixelBufferGetPixelFormatType(imageBuffer);
assert(pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange || pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange);
const size_t width = CVPixelBufferGetWidth(imageBuffer);
@bibhas
bibhas / AppDelegate.m
Created December 13, 2017 11:29 — forked from mattrajca/AppDelegate.m
MetalComputeOSX
//
// AppDelegate.m
// MetalComputeOSX
//
#import "AppDelegate.h"
@import Metal;
#define IMAGE_SIZE 128
@bibhas
bibhas / _baseline.scss
Created January 26, 2018 05:38 — forked from razwan/_baseline.scss
Aligning type to baseline the right way with SASS
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
// $base-font-size: 16px; // not sure this ever did anything
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
-(void) addAppAsLoginItem {
if ([self wasAppAddedAsLoginItem]) return;
NSString * appPath = [[NSBundle mainBundle] bundlePath];
// This will retrieve the path for the application
// For example, /Applications/test.app
CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:appPath];
// Create a reference to the shared file list.