Skip to content

Instantly share code, notes, and snippets.

View ademar111190's full-sized avatar
Lightning Networking the Bitcoin

Ademar ademar111190

Lightning Networking the Bitcoin
  • CEO of Bitcoin
  • Itatiba
View GitHub Profile
@jenslohmann
jenslohmann / toString Generator
Last active June 20, 2022 08:53
Java toString() generator for IntelliJ IDEA that generates JSON
public java.lang.String toString() {
#if ( $members.size() > 0 )
#set ( $i = 0 )
return "{\"_class\":\"$classname\", " +
#foreach( $member in $members )
#set ( $i = $i + 1 )
#if ( $i == $members.size() )
#set ( $postfix = "+" )
#else
#set ( $postfix = "+ "", "" + " )
@neworld
neworld / SearchViewFormatter.java
Last active April 14, 2020 17:08 — forked from ademar111190/SearchViewFormatter.java
Appcompat SearchView style formatter
package lt.mealdeal.android.utils;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.SearchView;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ImageSpan;
import android.view.View;
import android.widget.ImageView;
@leite
leite / gist:b085ccef34d8b3b082cb
Created June 18, 2014 02:39
parsing accept header(s)
-- @xxleite under [BeerWare] license
local string, io = require [[string]], require [[io]]
local gmatch, format, byte, write = string.gmatch, string.format, string.byte, io.write
-- common accept(s) content
local charsets = {
'*', 'utf-8', 'utf-8, ISO-8859-1', 'utf-8;q=0.8, ISO-8859-1',
//
// UIButtonBox.h
//
// Created by Jose Antonio Lopez on 28/11/13.
// Copyright (c) 2014 Asenit Technologies SL. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIButtonBox : UIButton
@leite
leite / gist:10679413
Created April 14, 2014 20:14
basic class simulacrum and basic hash object ... enjoy
-- ----------------------------------------------------------------------------
-- "THE BEER-WARE LICENSE" (Revision 42):
-- <[email protected]> wrote this file. As long as you retain this notice you
-- can do whatever you want with this stuff. If we meet some day, and you think
-- this stuff is worth it, you can buy me a beer in return
-- ----------------------------------------------------------------------------
local table, string = require [[table]], require [[string]]
local type, pairs, rawset, setmetatable, getmetatable =
package com.mastercard.android.atmlocator.view;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AbsListView;
import android.widget.GridView;
@dlo
dlo / Auto-layout-keyboard-adjustment.md
Last active February 26, 2021 07:33
How to adjust a view's height with Auto Layout when a keyboard appears or disappears in iOS 7.

This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.

Setting Up

The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.

Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.

@ademar111190
ademar111190 / .gitignore
Last active January 3, 2016 15:49
A little algorithm using genetic concepts to find a secret word.
out/*
@leite
leite / gist:8326589
Last active January 2, 2016 15:58
basic configuration of nginx.conf
user nginx www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
@mediavrog
mediavrog / gist:5625602
Last active March 20, 2024 16:59
Filter out Intents you don"t want to show from a IntentChooser dialog. For example your own app, competing apps or just apps you have a share integration by SDK already :) Based on http://stackoverflow.com/questions/5734678/custom-filtering-of-intent-chooser-based-on-installed-android-package-name/8550043#8550043
// Usage:
// blacklist
String[] blacklist = new String[]{"com.any.package", "net.other.package"};
// your share intent
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "some text");
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "a subject");
// ... anything else you want to add
// invoke custom chooser