Skip to content

Instantly share code, notes, and snippets.

View jeanpimentel's full-sized avatar
👨‍💻

Jean Pimentel jeanpimentel

👨‍💻
View GitHub Profile
@jeanpimentel
jeanpimentel / gist:1466975
Created December 12, 2011 12:41
[C#] [Kinect] Save a frame
void SaveFrame(ImageFrame frame)
{
var filePath = frame.Timestamp.ToString() + ".bmp";
using (var bitmap = new Bitmap(frame.Image.Width, frame.Image.Height, PixelFormat.Format32bppRgb))
{
var rect = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
var data = bitmap.LockBits(rect, ImageLockMode.ReadWrite, bitmap.PixelFormat);
Marshal.Copy(frame.Image.Bits, 0, data.Scan0, frame.Image.Bits.Length);
@jeanpimentel
jeanpimentel / why.md
Created March 29, 2012 03:26
PHP Grammar - Switch
unticked_statement:
...
| T_SWITCH '(' expr ')' { zend_do_switch_cond(&$3 TSRMLS_CC); } switch_case_list { zend_do_switch_end(&$6 TSRMLS_CC); }
| ...
;
switch_case_list:
'{' case_list '}' { $$ = $2; }
| '{' ';' case_list '}' { $$ = $3; }
| ':' case_list T_ENDSWITCH ';' { $$ = $2; }
@jeanpimentel
jeanpimentel / github.sh
Created April 23, 2012 13:15
curl -L git.io/github.sh | bash
#!/bin/bash
BASE_DIR="$(pwd)";
OWNER="${1}";
if [ "${OWNER}" == "" ];
then
OWNER=${USER}
fi;
curl -L "https://api.github.com/users/${OWNER}/repos" | grep '"name"' | cut -d \" -f 4 | while read repository;
@jeanpimentel
jeanpimentel / gist:2629008
Created May 7, 2012 17:07 — forked from lucasmezencio/gist:2629006
Which Linux Distro?
$ cat /etc/redhat-release #will show you information for red hat based distros.
$ cat /etc/SuSE-release #for SUSE based distros.
$ cat /etc/mandrake-release #for mandrake distros.
$ cat /etc/debian_version #for debian based distros.
$ cat /etc/UnitedLinux-release #might also return some more information.
@jeanpimentel
jeanpimentel / test.php
Created July 6, 2012 14:09
Strange behavior in PHP
<?php
class C1 {
protected $propertyProtected = 'foo';
}
class C2 {
public function test() {
$objC1 = new C1();
echo $objC1->propertyProtected;
@jeanpimentel
jeanpimentel / Makefile
Last active June 4, 2023 08:35 — forked from kanedo/Makefile
Makefile for Xcode C++ projects
#############################################################
# #
# Generic Makefile for C++ projects #
# Author: Gabriel <software@kanedo.net> #
# Date: 2014-04-18 #
# Version: 1.0 #
# #
#############################################################
@jeanpimentel
jeanpimentel / gist:567862db34def27edfae
Created January 27, 2016 16:43
Android Alpha Hex
100% — FF
99% — FC
98% — FA
97% — F7
96% — F5
95% — F2
94% — F0
93% — ED
92% — EB
91% — E8
package pl.kpob.utils.extensions
import android.app.Activity
import android.content.Context
import android.graphics.Color
import android.support.v4.content.ContextCompat
import android.view.WindowManager
import flow.Flow
import org.jetbrains.anko.AlertDialogBuilder
import pl.sisms.gminformix.utils.extensions.supportsLollipop
/*
* Copyright 2018 Lucio Maciel, Rocket.Chat
* Copyright 2016 Serj Lotutovici
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*