This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CGImageRef imageRef = CGWindowListCreateImage(CGRectInfinite, kCGWindowListOptionAll, kCGNullWindowID, kCGWindowImageDefault); | |
| CFMutableDataRef dataRef = CFDataCreateMutable(kCFAllocatorDefault, 0); | |
| CGImageDestinationRef dest = CGImageDestinationCreateWithData(dataRef, kUTTypePNG, 1, NULL); | |
| CGImageDestinationAddImage(dest, imageRef, NULL); | |
| CGImageDestinationFinalize(dest); | |
| CFRelease(dest); | |
| CGImageRelease(imageRef); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .idea/ | |
| .sconsign.dblite | |
| .svn/ | |
| .DS_Store | |
| *.swp | |
| *.lock | |
| profile | |
| DerivedData/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var simplifyPath = function( points, tolerance ) { | |
| // helper classes | |
| var Vector = function( x, y ) { | |
| this.x = x; | |
| this.y = y; | |
| }; | |
| var Line = function( p1, p2 ) { | |
| this.p1 = p1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| files = [] | |
| ["plist", "xml"].each { |t| Dir["**/*.#{t}"].each {|i| files << i} } | |
| files.each do |f| | |
| `xmllint --noout #{f}` | |
| puts "#{f} failed validation" if $?.exitstatus != 0 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| background: #f06; | |
| background: linear-gradient(22deg, #blue, yellow); | |
| min-height: 100%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| id objc_createInstanceOfClassWithPlatformSuperclass(Class clasz) { | |
| Class currentSuperclass = class_getSuperclass(clasz); | |
| Class originalSuperclass = objc_getClassRegisteredFirst(class_getName(currentSuperclass)); | |
| const char *currentClassName = [[NSString stringWithFormat:@"__%s", class_getName(clasz)] UTF8String]; | |
| // Allocate a new class par | |
| Class createdClass = objc_allocateClassPair(originalSuperclass, currentClassName, 0); | |
| if (createdClass == Nil) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Add ApplicationServices.h on Mac | |
| #import <ImageIO/ImageIO.h> | |
| #import <MobileCoreServices/MobileCoreServices.h> | |
| CGSize sz = self.renderNode.size; | |
| void *data = calloc(sz.width * sz.height * 4, sizeof(char)); | |
| glReadPixels(0, 0, sz.width, sz.height, GL_RGBA, GL_UNSIGNED_BYTE, data); | |
| CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); | |
| CGContextRef context = CGBitmapContextCreate(data, sz.width, sz.height, 8, sz.width * 4, colorSpace, kCGImageAlphaPremultipliedLast); | |
| CGColorSpaceRelease(colorSpace); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Omega Spec | |
| Ω interface Foo < Base :SomeProtocol | |
| Ω (read, write) Bar *bar; | |
| Ω (read) Baz *baz; | |
| Ω (read, copy) Burrito *burrito; | |
| Ω (atomic, write) Bang *bang; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. The texture target needs to be GLES20.GL_TEXTURE_EXTERNAL_OES instead of GL_TEXTURE_2D, e.g. in the glBindTexture calls and glTexParameteri calls. | |
| 2. In the fragment shader define a requirement to use the extension: | |
| #extension GL_OES_EGL_image_external : require | |
| 3. For the texture sampler used in the fragment shader, use samplerExternalOES instead of sampler2D. | |
| Everything below here is all in the C code, no more Java. | |
| 4. In the C code, use glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, eglImage) to specify where the data is, instead of using glTexImage2D family of functions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -(void) sandbox { | |
| EFDisplay *display = [EFDisplay defaultDisplay]; | |
| const EGLint attributes[] = { | |
| EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, | |
| EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | |
| EGL_NONE, /* termination sentinel */ | |
| }; | |
| EFSurfaceConfig *config = [display configurationsForAttributes:attributes].firstObject; |