Skip to content

Instantly share code, notes, and snippets.

Esteban Robles Luna estebanroblesluna

  • United States
Block or report user

Report or block estebanroblesluna

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:fdd3e5bd566ff4285cb3593d1131bda9
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_CUDA=ON \
-D ENABLE_FAST_MATH=1 \
-D WITH_FFMPEG=ON \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D BUILD_opencv_python3=yes \
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
View gist:6079220
- (void) drawRect:(CGRect)rect on: (id)context
{
CGContextSetFillColor(context, [self backgroundColor]);
CGContextFillRect(context, [self bounds]);
CGContextSetLineWidth(context, 0.5);
CGContextSetStrokeColor(context, [self foregroundColor]);
CGContextStrokeRect(context, [self bounds]);
}
View gist:6079207
- (id) initWithFrame: (CGRect) aFrame
{
[super initWithFrame: aFrame];
[self backgroundColor: [CPColor whiteColor]];
[self foregroundColor: [CPColor blackColor]];
[handles addObject: [Handle target: self selector: @"topLeft"]];
[handles addObject: [Handle target: self selector: @"topRight"]];
[handles addObject: [Handle target: self selector: @"bottomLeft"]];
View gist:6070376
[basicToolbox
addTool: [SimpleRectangleTool drawing: _drawing]
withTitle: @"Create rectangle"
image: @"Resources/Rectangle.png"];
View gist:6070367
- (void) createFigureAt: (id) aPoint on: (id) aDrawing
{
var frame = CGRectMake(aPoint.x, aPoint.y, 100, 50);
var newFigure = [SimpleRectangleFigure frame: frame];
[aDrawing addFigure: newFigure];
[self activateSelectionTool];
}
View gist:6070362
- (id) initWithFrame: (CGRect) aFrame
{
[super initWithFrame: aFrame];
[self backgroundColor: [CPColor whiteColor]];
[self foregroundColor: [CPColor blackColor]];
return self;
}
View gist:6070354
- (void) drawRect: (CGRect) rect on: (id) context
{
CGContextSetFillColor(context, [self backgroundColor]);
CGContextFillRect(context, [self bounds]);
CGContextSetLineWidth(context, 0.5);
CGContextSetStrokeColor(context, [self foregroundColor]);
CGContextStrokeRect(context, [self bounds]);
}
View ComputeMD5.java
import org.apache.commons.lang.StringUtils;
private String computeMD5(String string) throws NoSuchAlgorithmException {
byte[] stringBytes = string.getBytes();
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(stringBytes, 0, stringBytes.length);
String md5 = new BigInteger(1, messageDigest.digest()).toString(16);
md5 = StringUtils.leftPad(md5, 32, '0');
View hibernateFlow.xml
<spring:bean id="hibernateSessionAdvice" class="org.mule.hibernate.extensions.HibernateSessionAdvice">
<spring:constructor-arg index="0" ref="sessionFactory" />
</spring:bean>
<custom-processor name="openSessionMP" class="org.mule.hibernate.extensions.OpenHibernateSessionMP">
<spring:property name="advice" ref="hibernateSessionAdvice" />
</custom-processor>
<custom-processor name="closeSessionMP" class="org.mule.hibernate.extensions.CloseHibernateSessionMP">
<spring:property name="advice" ref="hibernateSessionAdvice" />
View HibernateSessionAdvice.java
public class HibernateSessionAdvice {
private static Log logger = LogFactory.getLog(HibernateSessionAdvice.class);
public static final String DEFAULT_SESSION_FACTORY_BEAN_NAME = "sessionFactory";
private String sessionFactoryBeanName = DEFAULT_SESSION_FACTORY_BEAN_NAME;
private boolean singleSession = true;
private FlushMode flushMode = FlushMode.MANUAL;
private SessionFactory sessionFactory;
You can’t perform that action at this time.