Skip to content

Instantly share code, notes, and snippets.

View yeradis's full-sized avatar

Yeradis P. Barbosa Marrero yeradis

View GitHub Profile
@yeradis
yeradis / gist:890762
Created March 28, 2011 16:20
ANDROID - Failed to find provider info for Calendar, Unknown URL content://calendar/events
funtcion Uri getCalendarURI(eventUri boolean){
Uri calendarURI = null;
if (android.os.Build.VERSION.SDK_INT <= 7 )
{
calendarURI = (eventUri)?Uri.parse("content://calendar/events"):Uri.parse("content://calendar/calendars");
}
else
{
calendarURI = (eventUri)?Uri.parse("content://com.android.calendar/events"): Uri.parse("content://com.android.calendar/calendars");
@yeradis
yeradis / gist:890783
Created March 28, 2011 16:34
ANDROID - Store and read an image on SQlite
To store an image file inside your SQLite db you should use a Blog field, and due Android SQlite limitations you should store info in this way:
ContentValues cv = new ContentValues();
//your table fields goes here
...
// adding the bitmap in byte array way to the blob field
ByteArrayOutputStream out = new ByteArrayOutputStream();
friendInfo.getImage_bmp().compress(Bitmap.CompressFormat.PNG, 100,out);
cv.put("avatar_img", out.toByteArray());
db.insert(TABLE_NAME, null, cv);
@yeradis
yeradis / gist:1300642
Created October 20, 2011 08:02
show progress bar for loading data on Button click in android #android
#android
This is what you need:
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
final ProgressDialog progress = ProgressDialog.show(THENAMEOFYOURACTIVITYCLASS.this,
ProgressTitle, ProgressMessage, true, false);
new Thread(new Runnable() {
@yeradis
yeradis / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@yeradis
yeradis / i18next-1
Created March 5, 2015 13:08
i18next simple sample
<!DOCTYPE html>
<html>
<head>
<!-- optional -->
<script type="text/javascript" src="[PATH]/jquery.js" />
<script type="text/javascript" src="[PATH]/i18next.js" />
</head>
<body>
<ul class="nav">
<li><a href="#" data-i18n="nav.home"></a></li>
@yeradis
yeradis / pilot_free.sh
Last active April 27, 2016 14:08
Custom lane
fastlane ios pilot_free
lane :pilot_free do
upload_testflight(
scheme:app_config[:app_scheme]
)
end
desc "Responsible for uploading to testfligh"
private_lane :upload_testflight do |options|
increment_build_number #increments the build number (an integer)
build_release(scheme:options[:scheme])
desc "Responsible for Generating APNs iOS Certificates and p12p"
private_lane :generate_apns do |options|
app_id= CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
pem_name = options[:pem_name];
scheme = (options[:development] ? "Development" : "Production")
pem(
development: options[:development],
force: options[:force],
private_lane :upload_itunes do |options|
# Make sure we don't have any uncommited changes
ensure_git_status_clean
ensure_git_branch(
branch: "(master|release\\S+|hotfix\\S+)"
)
increment_build_number(
xcodeproj:app_config[:app_project_path]
) #increments the build number (an integer),
int main(int argc, char * argv[])
{
@autoreleasepool {
Class appDelegateClass = NSClassFromString(@"QNTestingAppDelegate");
if (!appDelegateClass)
appDelegateClass = [QNAppDelegate class];
return UIApplicationMain(argc, argv, nil, NSStringFromClass(appDelegateClass));
}
}