Skip to content

Instantly share code, notes, and snippets.

// SSH config
// Enter SSH config, which is a per-user configuration file for SSH communication. Create a new file: ~/.ssh/config and open it for editing:
nano ~/.ssh/config
// Managing Custom Named SSH key
// The first thing we are going to solve using this config file is to avoid having to add custom-named SSH keys using ssh-add. Assuming your private SSH key is named ~/.ssh/id_rsa, add following to the config file:
Host github.com
newNumber = a => a + 100;
console.log(newNumber(5));
@slxny
slxny / darkmode.html
Created May 18, 2021 19:36
dark mode UI html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<header>Settings</header>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--TODO (6) Delete this TextView-->
<TextView
android:layout_width="wrap_content"
playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Enter intended consequences of clicking on playButton ImageView here
Log.v("Test: ", "Positive");
CountDownTimer countDownTimer = new CountDownTimer(100000, 100) {
@Override
public void onTick(long millisUntilFinished) {
TextView textView = (TextView) findViewById(R.id.main_timer_text);
ArrayAdapter<String> itemsAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, numbersList);
ListView listView = (ListView) findViewById(R.id.list);
listView.setAdapter(itemsAdapter);
@slxny
slxny / gist:c106b1bbc44e1bda03362c392e4806e1
Created April 13, 2017 03:02
view.getContext() vs MainActivity.this
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
Intent intent = new Intent(Intent.ACTION_INSERT)
.setData(CalendarContract.Events.CONTENT_URI)
.putExtra(CalendarContract.Events.TITLE, title)
.putExtra(CalendarContract.Events.EVENT_LOCATION, location)
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, begin)
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, end);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
@slxny
slxny / rain
Created April 7, 2017 15:35
I think I'm confusing myself
package com.example.android.justjava;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
public class Motor {
private int rpm;
public Motor(){
this.rpm = 0;
}
/* for all intents and purposes, is this the same as.. */