Skip to content

Instantly share code, notes, and snippets.

@ThrowJojo
ThrowJojo / 0_reuse_code.js
Created November 1, 2016 00:41
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
@ThrowJojo
ThrowJojo / section_headers.jsx
Created January 27, 2017 00:03
Creating lists with section headers in React Native
let timestamps = [
{ timestamp: Date.now(), period: Periods.ONE },
{ timestamp: Date.now(), period: Periods.ONE },
{ timestamp: Date.now(), period: Periods.ONE },
{ timestamp: Date.now(), period: Periods.THREE },
{ timestamp: Date.now(), period: Periods.FOUR }
];
function createTimestampMap(timestamps) {
@ThrowJojo
ThrowJojo / datestamp.jsx
Created January 27, 2017 00:05
Converting milliseconds to a readable date stamp
new Date(milliseconds).toLocaleDateString()
@ThrowJojo
ThrowJojo / build.gradle
Created February 15, 2017 03:02
Get rid of ResourceType error with ButterKnife
android {
...
lintOptions{
disable "ResourceType"
}
}
@ThrowJojo
ThrowJojo / ComposeEmail.java
Created May 31, 2017 05:33
Compose email intent for Android in Java.
public void composeEmail(String address, String subject) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:"));
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {address});
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
getActivity().startActivity(intent);
}
}
@ThrowJojo
ThrowJojo / index.ios.js
Created August 18, 2017 00:20
Ignoring yellow box warnings from React Native
console.ignoredYellowBox = ['Remote debugger is in a background'];
@ThrowJojo
ThrowJojo / download_wordpress.sh
Created August 18, 2017 00:34
Download Wordpress
wget http://wordpress.org/latest.tar.gz
tar xfz latest.tar.gz
@ThrowJojo
ThrowJojo / move_wordpress.sh
Created August 18, 2017 00:38
Move Wordpress installation files
mv wordpress/* ./
@ThrowJojo
ThrowJojo / signin_mysql.sh
Created August 18, 2017 00:41
Sign into MySQL
mysql -u username -p
@ThrowJojo
ThrowJojo / create_database.sql
Created August 18, 2017 00:45
Create a new database, grant permissions.
create database your_database;
grant usage on *.* to username@localhost identified by 'password';
grant all privileges on your_database.* to username@localhost;