Skip to content

Instantly share code, notes, and snippets.

View wavecos's full-sized avatar

Jose Alfredo Arias S. wavecos

View GitHub Profile
@wavecos
wavecos / ios-uisearchbar-background-color.md
Last active November 19, 2021 00:09
Customize Color, background from UISearchBar in Swift

Customize Color, background from UISearchBar in Swift

// as UISearchBar extension
extension UISearchBar {
  func changeSearchBarColor(color : UIColor) {
    for subView in self.subviews {
      for subSubView in subView.subviews {
        if subSubView.conformsToProtocol(UITextInputTraits.self) {
          let textField = subSubView as UITextField
 textField.backgroundColor = color
@wavecos
wavecos / gist:8718bd15064a1b688f92
Last active February 14, 2021 23:25
Fix Image Orientation, Rotation #swift #ios
http://stackoverflow.com/questions/5427656/ios-uiimagepickercontroller-result-image-orientation-after-upload
extension UIImage {
func fixOrientation() -> UIImage {
if (self.imageOrientation == UIImageOrientation.Up) {
return self;
}
@wavecos
wavecos / enable-alcatraz
Last active September 21, 2015 01:24
Enable Alcatraz in XCode 6.x or XCode 7.x
# http://pablin.org/2015/05/27/re-enable-alcatraz-on-xcode-6-dot-3-2-or-newer/
# To read restriction:
defaults read com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-6.x
# To enable:
defaults delete com.apple.dt.Xcode DVTPlugInManagerNonApplePlugIns-Xcode-6.x
@wavecos
wavecos / gist:0ce4bc9fc0b6ad8a8323
Created June 24, 2015 22:43
Hacer correr docker con Odoo en Mac OS
Para hacer correr odoo:
# 1. Levantar boot2docker:
boot2docker up
# 2. hacer correr los exports que te salen (si es que te presenta)
# 3. Solo la primera vez!
========================
@wavecos
wavecos / git-reset-repository
Created July 1, 2015 12:56
git: Reset Local Repository (undo changes) like HEAD
# http://stackoverflow.com/questions/1628088/reset-my-local-repository-to-be-just-like-remote-repository-head
# http://stackoverflow.com/questions/5473/how-can-i-undo-git-reset-hard-head1
git fetch origin
git reset --hard origin/master
# Optionally
git reset --hard HEAD
@wavecos
wavecos / ios-statusbar-color.md
Last active August 29, 2015 14:26
Change status bar color

Change status bar color in iOS

http://www.folio3.com/blog/change-status-bar-color-ios-app/

  1. Open the info.plist file of your app and set the UIViewControllerBasedStatusBarAppearance to NO
  2. Put this in app delegate:
  // Status Bar Color
  UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)
@wavecos
wavecos / raspberrypi-backup-restore-sd.txt
Last active August 12, 2018 05:27
Backup/Restore Raspberry Pi SD Card in Mac OS
# http://raspberrypi.stackexchange.com/questions/311/how-do-i-backup-my-raspberry-pi
diskutil list
# backup:
sudo dd if=/dev/disk2 of=raspberrypi20151118.img bs=1m
# restore:
dd if=sd.img of=/dev/sdb bs=4M
public class DetailActivity extends AppCompatActivity implements MediaPlayer.OnPreparedListener
...
private MediaPlayer mediaPlayer;
...
// Setup MediaPlayer
mediaPlayer = new MediaPlayer();
mediaPlayer.setOnPreparedListener(this);
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mediaPlayer.setDataSource(REPLACE_WITH_SOME_URL_RESOURCE);
    <changeSet id="20161231000001" author="jhipster">

        <sql>SET FOREIGN_KEY_CHECKS=0;</sql>

        <loadData encoding="UTF-8"
                  file="config/liquibase/enterprises.csv"
                  separator="|"
                  tableName="enterprise">
 

Dynamic UITableViewCell height

  1. Use auto layout
  2. Set this:
    self.tableView.rowHeight = UITableViewAutomaticDimension
    self.tableView.estimatedRowHeight = 120 // Any referencial height