Skip to content

Instantly share code, notes, and snippets.

@Ikhiloya
Ikhiloya / PlacePredictionProgrammatically.java
Created June 1, 2019 23:25
A sample code that shows how to get place predictions programmatically to create a customized user experience using Google Places Autocomplete Search Ft
public class PlacePredictionProgrammatically extends AppCompatActivity {
private static final String TAG = PlacePredictionProgrammatically.class.getSimpleName();
private EditText queryText;
private Button mSearchButton;
private TextView mSearchResult;
private StringBuilder mResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@groz
groz / sync-http.swift
Created February 15, 2018 22:29
Synchronous http request in Swift
import Foundation
func query(address: String) -> String {
let url = URL(string: address)
let semaphore = DispatchSemaphore(value: 0)
var result: String = ""
let task = URLSession.shared.dataTask(with: url!) {(data, response, error) in
result = String(data: data!, encoding: String.Encoding.utf8)!
@enzinier
enzinier / change-git-author.sh
Last active October 17, 2020 17:43
Change pushed authors in git.
#!/bin/sh
git filter-branch -f --env-filter '
OLD_EMAIL="jasondevelop@outlook.com"
CORRECT_NAME="Jason Park"
CORRECT_EMAIL="enzinier@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@enzinier
enzinier / run_android_emulator.sh
Created March 5, 2017 02:31
Run android emulator by command in terminal.
#! /bin/bash
# (@) start-android
# If the emulator command exists on this device, displays a list of emulators
# and prompts the user to start one
# ref. http://stackoverflow.com/questions/7837952/what-is-the-command-to-list-the-available-avdnames
# Check if the emulator command exists first
if ! type emulator > /dev/null; then
echo "emulator command not found"
exit 1
@mlsmith
mlsmith / gist:c6f96bf26f91ae03160a60b958d64c8b
Last active October 25, 2019 11:10
Install FFMPEG on Mac OS X with x265
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
# Streaming with FFMPEG
# https://trac.ffmpeg.org/wiki/StreamingGuide
ffmpeg -f avfoundation -i "1:0" -c:v libx265 -preset fast -c:a libfdk_aac -b:a 160k test.mkv
I am not a fan of Xcode. Here are ~160~ 200 problems, the first hundred or so issues were filed mostly in
July and August 2016 in a fit of rage. Mostly on weekends working (slowly) on side-projects. I have also
taken days of my employer's time filing others of these - so the company was not getting value for my time.
I believe a paid intern could have found many of these - just start a screen recorder, and when you see something,
stop and cut a quick movie. Many have been around for several major versions.
I'm volunteering chunks of my life (15-30 minutes per) to one of the most valuable companies in the world, which seems
kind of messed up. Things get worse the more complex the project and the longer Xcode been's running.
Apple folks - check out rdar://22524679
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active May 25, 2024 06:37
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

Git Cheat Sheet

Commands

Getting Started

git init

or

@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update