Skip to content

Instantly share code, notes, and snippets.

View chelseatroy's full-sized avatar

Chelsea Troy chelseatroy

View GitHub Profile
@chelseatroy
chelseatroy / AppDelegate.swift
Created May 8, 2016 23:38
Code-Only UI Demonstration: AppDelegate
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
//let splitViewController = self.window!.rootViewController as! UISplitViewController
//splitViewController.delegate = self
let window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window = window
window.rootViewController = MasterViewController()
window.makeKeyAndVisible()
@chelseatroy
chelseatroy / MasterViewController.swift
Created May 8, 2016 23:57
Code-only UI Demonstration: ViewController
class MasterViewController: UIViewController {
var activityIndicatorView: UIActivityIndicatorView = UIActivityIndicatorView()
var baseView: UIView = UIView()
override func viewDidLoad() {
super.viewDidLoad()
baseView.frame = CGRect.zero;
baseView.translatesAutoresizingMaskIntoConstraints = false
@Configuration
@EnableIntegration
public class ExampleConfiguration {
@Bean
IntegrationFlow inboundFlow(
ErrorManager errorManager,
SeatSelector seatSelector,
Prioritizer priority
) {
@Configuration
@EnableBatchProcessing
public class XmlParsingApplication {
@Bean
public StaxEventItemReader itemReader() throws Exception {
StaxEventItemReader reader = new StaxEventItemReader<>();
reader.setName("birthday");
reader.setResource(new ClassPathResource("all_members.xml"));
@Override
public void onLoadFinished(Loader<Cursor> loader, final Cursor data) {
switch (loader.getId()) {
case FRUIT_LOADER:
//do things with the fruits data
break;
case VEGGIE_LOADER:
//do things with the vegetables data
break;
}
public class NutritionFactFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
public static final int FRUIT_LOADER = 1;
public static final int VEGGIE_LOADER = 2;
...
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case FRUIT_LOADER:
public class NutritionFactFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
public static final int FRUIT_LOADER = 1;
public static final int VEGGIE_LOADER = 2;
...
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case FRUIT_LOADER:
repositories{
flatDir{
dirs 'libs'
}
}
dependencies {
//Design and Aminations
compile 'com.android.support:cardview-v7:23.1.1'
compile (name:'library-2.4.1', ext:'aar')
flipButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (mCardSideShowing.equals(CardSide.FRONT)) {
getActivity().getFragmentManager()
.beginTransaction()
.setCustomAnimations(R.animator.card_flip_right_in, R.animator.card_flip_right_out, R.animator.card_flip_left_in, R.animator.card_flip_left_out)
.replace(R.id.card_fragment_container, new CardBackFragment())
.commit();
@chelseatroy
chelseatroy / ExampleViewController.swift
Last active September 7, 2016 13:04
View Controller for Testing with Storyboard
class ExampleViewController: UITableViewController {
@IBOutlet var someTextLabel: UITextLabel!
class func loadFromStoryboard() -> ExampleViewController
{
let controller = UIStoryboard(name:"Main", bundle:NSBundle(forClass:self))
.instantiateViewControllerWithIdentifier("ExampleViewController")
as! ExampleViewController