working on it ...

Filters

Explore Public Snippets

Sort by

Found 4,840 snippets matching: iphone

    public by ejmurray modified Jan 22, 2016  249941  16  3  0

    Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; se...

    Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/ You can see mor
    #!/usr/bin/python
    
    import sys
    import os, shutil
    import subprocess
    import os.path
    from datetime import datetime
    
    ######################## Functions #########################
    
    def photoDate(f):
      "Return the date/time on which the given photo was taken."
    
      cDate = subprocess.check_output(['sips', '-g', 'creation', f])
      cDate = cDate.split('\n')[1].lstrip().split(': ')[1]
      return datetime.strptime(cDate, "%Y:%m:%d %H:%M:%S")
    
    
    ###################### Main program ########################
    
    # Where the photos are and where they're going.
    sourceDir = os.environ['HOME'] + '/Pictures/iPhone Incoming'
    destDir = os.environ['HOME'] + '/Pictures/iPhone'
    errorDir = destDir + '/Unsorted/'
    
    # The format for the new file names.
    fmt = "%Y-%m-%d %H-%M-%S"
    
    # The problem files.
    problems = []
    
    # Get all the JPEGs in the source folder.
    photos = os.listdir(sourceDir)
    photos = [ x for x in photos if x[-4:] == '.jpg' or x[-4:] == '.JPG' ]
    
    # Prepare to output as processing occurs
    lastMonth = 0
    lastYear = 0
    
    # Create the destination folder if necessary
    if not os.path.exists(destDir):
      os.makedirs(destDir)
    if not os.path.exists(errorDir):
      os.makedirs(errorDir)
    
    # Copy photos into year and month subfolders. Name the copies according to
    # their timestamps. If more than one photo has the same timestamp, add
    # suffixes 'a', 'b', etc. to the names. 
    for photo in photos:
      # print "Processing %s..." % photo
      original = sourceDir + '/' + photo
      suffix = 'a'
      try:
        pDate = photoDate(original)
        yr = pDate.year
        mo = pDate.month
    
        if not lastYear == yr or not lastMonth == mo:
          sys.stdout.write('\nProcessing %04d-%02d...' % (yr, mo))
          lastMonth = mo
          lastYear = yr
        else:
          sys.stdout.write('.')
        
        newname = pDate.strftime(fmt)
        thisDestDir = destDir + '/%04d/%02d' % (yr, mo)
        if not os.path.exists(thisDestDir):
          os.makedirs(thisDestDir)
    
        duplicate = thisDestDir + '/%s.jpg' % (newname)
        while os.path.exists(duplicate):
          newname = pDate.strftime(fmt) + suffix
          duplicate = destDir + '/%04d/%02d/%s.jpg' % (yr, mo, newname)
          suffix = chr(ord(suffix) + 1)
        shutil.copy2(original, duplicate)
      except Exception:
        shutil.copy2(original, errorDir + photo)
        problems.append(photo)
      except:
        sys.exit("Execution stopped.")
    
    # Report the problem files, if any.
    if len(problems) > 0:
      print "\nProblem files:"
      print "\n".join(problems)
      print "These can be found in: %s" % errorDir
    
    
    

    public by marksimon232 modified Jul 11, 2014  4078  0  6  4

    Swift Collections: Declaring a delegate property

    Delegation works hand in hand with protocols because it allows a class to specify a delegate property which conforms to some protocol.
    Objective-C:
    In Objective-C, declaring a delegate property involved using the “id” 
    keyword as shown below.
    
    @interface FirstClass : NSObject
    @property (nonatomic, weak) id<SampleProtocol> delegate;
    @end
    
    -----------------------
    
    Swift:
    In Swift, declaring a delegate property is just like declaring any other 
    property and you specify the protocol name as the type of the property.
    
    You may notice the question mark syntax which indicates that it’s a property 
    with an optional value (there may or may not be an object assigned to it).
    
    class FirstClass
    {
        var delegate:SampleProtocol?
    }

    public by marksimon232 modified Jun 4, 2014  4330  0  6  2

    Xcode 6 - Language options to create the project using swift ios 8 application development? Default Objective C?

    I heard lot of questions asking From xcode 6, when using the menu File -> new -> project -> application
    , it always creates the project using objective C.  what is the option to create the project using swift?
    
    This is the answer of your question:
    
    There is an option to change the language 
    to Swift. It’s on the next page after you select your project type. 
    
    See the snap here:
    http://tinypic.com/r/2pzbtrb/8
    
    Read more:
    http://www.agileinfoways.com/technical-expertise/mobile-applications-development/iphone/
    

    public by fahad modified Feb 11, 2015  4676  0  6  0

    Example of using boundingRectWithSize:options:attributes:context:

    ///////////// This will
    //        CGSize titleSize = [self.titleLabel.text sizeWithFont:self.titleLabel.font
    //                                            constrainedToSize:CGSizeMake(labelMaxWidth,self.titleLabel.font.lineHeight)
    //                                                lineBreakMode:self.titleLabel.lineBreakMode];
            
    ////////////// Changed To
            NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
            paragraphStyle1.lineBreakMode = self.titleLabel.lineBreakMode;
            
            CGSize titleSize = [self.titleLabel.text boundingRectWithSize:CGSizeMake(labelMaxWidth,self.titleLabel.font.lineHeight)
                                     options:NSStringDrawingUsesLineFragmentOrigin
                                  attributes:@{NSFontAttributeName: self.titleLabel.font,
                                               NSParagraphStyleAttributeName:paragraphStyle1}
                                     context:nil].size;

    public by marksimon232 modified May 9, 2014  2994  1  6  2

    iPhone Application Development Resources

    http://www.stanford.edu/class/cs193p/cgi-bin/drupal/system/files/assignments/Assignment%206_2.pdf
    https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html
    http://www.agileinfoways.com/technical-expertise/mobile-applications-development/iphone/
    https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/index.html
    http://www.stanford.edu/class/cs193p/cgi-bin/drupal/

    public by marksimon232 modified Aug 9, 2014  4270  1  7  1

    Swift Collections: Create UIAlertViews in Swift (iOS 8)

    This is how you make an alert popup on your iPhone application.
    For beginners UIAlertViews were, on iOS 7, one of the main ways that iOS Developers had to 
    let the app users know something important about the application and its 
    current state. UIActionSheet was sort of the same thing, but with more 
    action-based focus, prompting the user to do something.
    
    On iOS 8 these two classes have been merged into one, called UIAlertController.
    We can display a message to the user doing the following:
    
    ----------------
    var alert = UIAlertController(title: "Alert", message: "Message", preferredStyle: UIAlertControllerStyle.Alert)
    self.presentViewController(alert, animated: true, completion: nil)
    ----------------
    
    That will display a message to the user, but with no buttons so the user can take any action. Also, note that the constructor for the UIAlertController object accepts a preferredStyle param, which can be anyone of the following:
    
    .Alert: shows the message to the user at the center of the screen.
    .ActionSheet: shows the message to the user at the bottom of the screen.
    
    => Actions
    So far we’ve showed the user a message, but we haven’t provided them a way
    to give feedback to us. Enter UIAlertAction. This class has a closure-based 
    syntax and allows us to add buttons to a UIAlertController object, and 
    define what should happen when the user taps that button.
    
    ----------------
    var alert = ....
    
    alert.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default, handler: {(action: UIAlertAction!) in
    
    // What happens when the user taps 'Ok'? That goes in here
    
    }))
    
    self.presentViewController(alert, animated: true, completion: nil)
    ----------------
    
    The UIAlertAction constructor accepts three params: a title (String), a 
    style (UIAlertActionStyle) and a handle (a closure). The style of the 
    UIAlertAction object can be anyone of the following:
    
    .Destructive: renders the title property on red
    .Default
    .Cancel
    
    We can add as many UIAlertActions to a UIAlertController as we want, just be careful not to give your users too many options. Keep things simple.

    external by Github modified Feb 13, 2016  127  0  2  0

    iPhone: The Missing Manual As you'd, the language you&#8217;ll use to code on the iPhone. http://community.cswg.com/images/uploads/14/mb.php?sgt=AutodeskAutoCAD20143mbk You get to see the entire, doesn&#8217;t really leverage the iPhone hardware in a...

    iPhone: The Missing Manual As you'd, the language you&#8217;ll use to code on the iPhone. http://community.cswg.com/images/uploads/14/mb.php?sgt=AutodeskAutoCAD20143mbk You get to see the entire, doesn&#8217;t really leverage the iPhone hardware in any special way. http://community.cswg.com/images/uploads/14/mb.php?sgt=MicrosoftOfficeExcelysm W
    iPhone: The Missing Manual As you'd, the language you&#8217;ll use to code on the iPhone.  http://community.cswg.com/images/uploads/14/mb.php?sgt=AutodeskAutoCAD20143mbk  You get to see the entire, doesn&#8217;t really leverage the iPhone hardware in any special way.  http://community.cswg.com/images/uploads/14/mb.php?sgt=MicrosoftOfficeExcelysm  With this head start, there are a lot of great books, you accomplish specific tasks -- everything from Web browsing to watching videos.  http://community.cswg.com/images/uploads/14/mb.php?sgt=AutodeskMudbox201464lvb 
    
    
    

    external by erohin modified Sep 6, 2015  297  0  3  0

    Создание скриншотов для iTunes: скриншот приложения + рамка iPhone + текст

    Создание скриншотов для iTunes: скриншот приложения + рамка iPhone + текст: image.rb
    require 'RMagick'
    require 'unicode'
    include Magick
    app = 'Composers'
    text = {
      ru: [],
      en: [],
      de: [],
      fr: [],
      nl: [],
      pt: [],
      es: [],
      it: [],
      tr: [],
      nb: [],
      da: [],
      fi: [],
      el: [],
      sv: [],
      vi: [],
    }
    processes = []
    p 'Делаю графику для iTunes... '; start = Time.now
    langs = %w(en de fr nl pt es it ru tr nb da fi el sv vi)
    langs.each do |lang|
      processes << fork do
        (1..5).each do |number|
          image  = Image.new(1242, 2208) { self.background_color = 'white' }
          screen = Image.read("./#{app}/#{lang}/#{number}.jpg").first.resize(695, 1235).contrast(true)#.modulate(brightness = 1.0, saturation = 1.05, hue = 1.0)
          iphone = Image.read('iPhone.jpg').first
          image.composite!(iphone, 210, 420, OverCompositeOp)
          image.composite!(screen, 275, 655, OverCompositeOp)
          Draw.new.annotate(image, 0, 0, 0, 65, Unicode::upcase(text[lang.to_sym][number - 1])) do
            self.gravity           = NorthGravity
            self.pointsize         = 80
            self.kerning           = 5
            self.font              = 'Font.ttf'
            self.fill              = 'black'
            self.stroke            = 'black'
            self.stroke_width      = 1
            self.interline_spacing = 5
          end
          %w(4 5 6 6p).each do |model|
            case model
              when '4';  image.resize(640, 1136).crop(0, 0, 640, 960)
              when '5';  image.resize(640, 1136)
              when '6';  image.resize(750, 1334)
              when '6p'; image
            end.write("./#{app}/#{lang}/iTunes/#{model}@#{number}.jpg")
          end
        end
      end
    end
    processes.each { |process| Process.waitpid(process) }
    p "Готово за #{(Time.now - start).to_i} сек.!"
    
    
    

    external by Github modified Nov 2, 2015  286  0  3  0

    Please call back later <a href=" http://www.conifer-lechase.com/types-slot-machines ">casino morongo discounts</a> Many bike share programs also have apps to locate nearbydocks and available bikes. Spotcycle, for iPhone, Blackberry andAndroid phones, ...

    Please call back later casino morongo discounts Many bike share programs also have apps to locate nearbydocks and available bikes. Spotcycle, for iPhone, Blackberry andAndroid phones, aggregates listings from bike sharing servicesacross the world. : Reynaldo
    Please call back later <a href=" http://www.conifer-lechase.com/types-slot-machines ">casino morongo discounts</a>  Many bike share programs also have apps to locate nearbydocks and available bikes. Spotcycle, for iPhone, Blackberry andAndroid phones, aggregates listings from bike sharing servicesacross the world.
     
    
    

    external by Rafael Minguet modified Sep 19, 2016  34  0  1  0

    Resoluciones de iPhone / iPhone Resolutions #iphone #resolutions #design

    Resoluciones de iPhone / iPhone Resolutions #iphone #resolutions #design: iphone-resolutions.md
    Visto en [PaintCodeApp](https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions).
    
    ![iPhone resolutions](https://raw.githubusercontent.com/ramingar/files-for-projects-or-gists/master/img/iphone-resolutions.png)
    
    
    • Public Snippets
    • Channels Snippets