Skip to content

Instantly share code, notes, and snippets.

View leapingbytes's full-sized avatar

Andrei Tchijov leapingbytes

View GitHub Profile
@leapingbytes
leapingbytes / LBGradientButton.h
Created February 2, 2012 14:37
LBGradientButton
//
// TBRButton.h
// TBR
//
// Created by andrei tchijov on 2/7/11.
// Copyright 2011 Leaping Bytes, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <Foundation/Foundation.h>
@interface NSString (LBToolbox)
- (CGSize) sizeWithWidth: (CGFloat) width andFont: (UIFont*) font;
@end
@leapingbytes
leapingbytes / d007_module.class.inc
Last active December 21, 2015 07:29
Base classes for OO-Drupal 7 - DOO7 See the corresponding blog post at https://www.leapingbytes.com/blog/doo7_you_can_teach_old_dog_new_tricks
<?php
/** @file
* Base classes for OO-Drupal 7 - DOO7 :)
*
* @author atchijov
*
*/
/**
* Poor man mixins.
@leapingbytes
leapingbytes / LBAlertView.h
Created August 25, 2013 22:10
Subclass for UIAlertView which allows to use blocks instead of delegate
#import <UIKit/UIKit.h>
typedef void (^LB_ALERT_BLOC)(UIAlertView* alertView, int buttonIndex);
@interface LBAlertView: UIAlertView<UIAlertViewDelegate>
@property(strong, nonatomic) LB_ALERT_BLOC onClickBlock_;
- (void) setOnClickBlock: (LB_ALERT_BLOC) aBlock;
@leapingbytes
leapingbytes / SqlJoinProxy.js
Created August 28, 2013 06:59
Extension to Ext.data.proxy.Sql to allow specifying JOINs You are free to use this code in any of your projects (open source or otherwise). I would appreciate if you mentioned my name (Andrei Tchijov @ Leaping Bytes, LLC) if you do.
Ext.define('LB.store.SqlJoinProxy', {
alias: 'proxy.sqljoin',
extend: 'Ext.data.proxy.Sql',
config: {
/**
* config below will join table image ON image_id = i.id and will select field image_thumbnail as thumbnail and
* field image_full_size as full_size
*
* joins: [{
@leapingbytes
leapingbytes / gist:6832881
Created October 4, 2013 21:13
this seems to work. it reports reasonable attributes. for example for bold + italic: attributes : name : content attributes : font-style : italic attributes : color : #ffffff attributes : b : attributes : i : attributes : font-weight : bold attributes : font-family : Arial attributes : font : size=3 color=#ffffff face=Arial attributes : font-siz…
Caret cr = me.reachTextField.getCaret();
int position = cr.getDot()
Element e = me.reachTextField.getStyledDocument().getCharacterElement(position);
AttributeSet attributes = e.getAttributes();
Enumeration attributeNames = attributes.getAttributeNames();
while(attributeNames.hasMoreElements()) {
Object name = attributeNames.nextElement();
System.out.println("attributes : " + name + " : " + attributes.getAttribute(name));
}
@leapingbytes
leapingbytes / gist:949b34ac7bd83965233f
Created July 12, 2014 11:28
How to make Wildfly send "Connection: close" instead of "Connection: keep-alive"
<subsystem xmlns="urn:jboss:domain:undertow:1.1">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" always-set-keep-alive="false"/>
<https-listener name="default-s" socket-binding="https" security-realm="UndertowRealm" always-set-keep-alive="false"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<access-log prefix="access"/>
<filter-ref name="connection-close"/>
<filter-ref name="server-header"/>
@leapingbytes
leapingbytes / Overview
Created August 6, 2014 13:43
Workaround for UNDERTOW-282
This solution is based on comment https://issues.jboss.org/browse/UNDERTOW-282?focusedCommentId=12986535&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-12986535
This fix was tested with Wildfly 8.1.0 Final.
NOTE: io.undertow.servlet.ServletExtension file should go into META-INF/services/io.undertow.servlet.ServletExtension
@leapingbytes
leapingbytes / fails
Created October 8, 2014 10:32
@schedule annotation produces "Cannot invoke timeout method because method null is not a timeout method" upon second and all consecutive executions
@Singleton
@Startup
public class SettingsManagerImpl implements SettingsManager {
...
@Schedule(hour = "*", minute = "*", second="13")
public void checkSettingsProviders() {
...
}
...
}
@leapingbytes
leapingbytes / AMQWx-conf-activemq.xml
Created September 14, 2015 01:01
ActiveMQ 5.12 + Wildfly 8.2
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<!-- Allows us to use system properties as variables in this configuration file -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>