Skip to content

Instantly share code, notes, and snippets.

View teocci's full-sized avatar
👨‍💻
Coding

Teocci teocci

👨‍💻
Coding
View GitHub Profile
/*
* Copyright (c) 2014 by Bart Kiers
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
import android
import time
from datetime import date, datetime
def log_battery_status(droid):
"""Log battery percentage"""
droid.batteryStartMonitoring()
battery = 0
while not battery:
battery = droid.batteryGetLevel().result
@teocci
teocci / RecordingVideo.js
Created April 11, 2016 19:57 — forked from dawsontoth/RecordingVideo.js
How to record video, then share or save it. Using Appcelerator Titanium!
/**
* This sample lets you record and share video with Appcelerator Titanium on Android.
* REQUIRES THE 1.6.0 RC OF TITANIUM MOBILE SDK
* http://developer.appcelerator.com/blog/2011/02/release-candidate-for-titanium-mobile-1-6-0.html
*/
/**
* First, create our UI. We'll have two buttons: record, and share.
*/
var win = Titanium.UI.createWindow({
@teocci
teocci / GITMigrator
Last active April 28, 2016 07:11
Proces to migrate a Forket Project from Eclipse to Android Studio and then update the git repo with the new Android Studio repo.
Move to the new repo Directory
cd newrepo
Add all the files to be commited
git --git-dir=/path/to/my/oldrepo/.git/ --work-tree=/path/to/my/newrepo/ add .
Commit the changes
git --git-dir=/path/to/my/oldrepo/.git/ --work-tree=/path/to/my/newrepo/ commit -a -m "This is the Android Studio version"
Add the remote origin
@teocci
teocci / GITMigrator
Created April 28, 2016 07:11
Proces to migrate a Forket Project from Eclipse to Android Studio and then update the git repo with the new Android Studio repo.
Move to the new repo Directory
cd newrepo
Add all the files to be commited
git --git-dir=/path/to/my/oldrepo/.git/ --work-tree=/path/to/my/newrepo/ add .
Commit the changes
git --git-dir=/path/to/my/oldrepo/.git/ --work-tree=/path/to/my/newrepo/ commit -a -m "This is the Android Studio version"
Add the remote origin
# Built application files
/*/build
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files
@teocci
teocci / The Other Road Ahead
Created May 11, 2016 04:21
Paul Graham, "Hackers and Painters", chapter 5: «The Other Road Ahead»
http://paulgraham.com/road.html
MediaRecorder mediaRecorder = new MediaRecorder();
CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
profile.videoFrameWidth = 1280;
profile.videoFrameHeight = 720;
mediaRecorder.setCamera(Camera.open());
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
mediaRecorder.setProfile(profile);
@teocci
teocci / MVCMusicStore.md
Last active June 2, 2016 16:13
This is a tutorial application that introduces and explains step-by-step how to use ASP.NET MVC and Visual Studio for web development.

MVC Music Store

This is a tutorial application that introduces and explains step-by-step how to use ASP.NET MVC and Visual Studio for web development.

The MVC Music Store is a lightweight sample store implementation which sells music albums online, and implements basic site administration, user sign-in, and shopping cart functionality.

This tutorial series details all of the steps taken to build the ASP.NET MVC Music Store sample application. Part 8 covers Shopping Cart with Ajax Updates. We’ll allow users to place albums in their cart without registering, but they’ll need to register as guests to complete checkout. The shopping and checkout process will be separated into two controllers: a ShoppingCart Controller which allows anonymously adding items to a cart, and a Checkout Controller which handles the checkout process. We’ll start with the Shopping Cart in this section, then build the Checkout process in the following section.

Adding the Cart, Order, and OrderDetail model classes

@teocci
teocci / ViewDataVS.md
Last active June 10, 2021 19:10
In ASP.NET MVC there are three ways - ViewData, ViewBag and TempData to pass data from controller to view and in next request.

ViewData vs ViewBag vs TempData vs Session

In ASP.NET MVC there are three ways - ViewData, ViewBag and TempData to pass data from controller to view and in next request. Like WebForm, you can also use Session to persist data during a user session. Now question is that when to use ViewData, VieBag, TempData and Session. Each of them has its own importance. In this article, I am trying to explain the differences among these four.

ViewData

ViewData is a dictionary object that is derived from ViewDataDictionary class.

public ViewDataDictionary ViewData { get; set; }

ViewData is a property of ControllerBase class. ViewData is used to pass data from controller to corresponding view. It’s life lies only during the current request.