Skip to content

Instantly share code, notes, and snippets.

I said yeah.

Sofia Swidarowicz phynet

I said yeah.
View GitHub Profile
View gist:10732884
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *cellName = @"CellViewName";
CellChatEditNameGroup *aCellName = [tableView dequeueReusableCellWithIdentifier:cellName];
if (aCellName == nil) {
NSArray *views = [[NSBundle mainBundle] loadNibNamed:cellName owner:nil options:nil];
aCellName = (CellViewName *)[views objectAtIndex:0];
View designer.html
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../yt-video/yt-search-video.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
View gist:57b3c6548dd8948423f9

##Extension A Swift extension is similar to an Objective-C category. Extensions expand the behavior of existing classes, structures, and enumerations, including those defined in Objective-C.

extension Double {
   var km: Double { return self * 1_000.0 }
   var m: Double { return self }
   var cm: Double { return self / 100.0 }
   var mm: Double { return self / 1_000.0 }
   var ft: Double { return self / 3.28084 }
View Translate removeObjectAtIndex from NSMutableArray into Array in Swift.mkd

##Translate removeObjectAtIndex from NSMutableArray into Array in Swift

If you were wondering how in hearth you could removeObject from an Array declared in Swift... I was in your same predicament. Thankfully there are people out there that came first, and found a solution. I'm goin to translate it here for you all and of course, for me...

###Objective-C code:

[self.selectedRows removeObject:[NSNumber numberWithLong:indexPath.row]];
View Recursivity in Swift 2.mkd

Taken from Stackoverflow

func f(n: Int) {
  func lap(n: Int) -> Int {
    if n == 0 { return 0 }
    return lap(n - 1)
View Obtaining-characters-from-a-String-in-SWIFT.mkd

Previous Swift 2.0, the option .character for String's type, was obtained using advance and startIndex (pretty much a pain in the butt, so make it an extension and you could have the characters :P )

var kString = "My string"
var countString = count(kString)

for i in 0...countString - 1 {
  let index = advance(kString.startIndex, i)
  print("INSIDE FOR \(kString[index])")
phynet / observer_updateData.m
Created Sep 14, 2015
Using NSNotification to update data
View observer_updateData.m
__typeof__(self) __weak wself = self;
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
[wself updateData];
View NSOrderedSet.swift
let orderedSet = NSOrderedSet(array: [ 42, 43, 44])
var enumarator = orderedSet.reversedOrderedSet
for elem in orderedSet {
print("elements \(elem)")
phynet / parse.js
Created Nov 11, 2015
To know which column/property has been changed in beforeSave in PARSE
View parse.js
for (var i in userPoints.dirtyKeys()) {
var dirtyKey = userPoints.dirtyKeys()[i];
alert("DIRTY KEY val " + dirtyKey);
phynet / UIView-shadow.m
Created Dec 21, 2015
Create a shadow under a uiview
View UIView-shadow.m
UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:self.menuView.bounds];
self.menuView.layer.masksToBounds = NO;
self.menuView.layer.shadowColor = [UIColor blackColor].CGColor;
self.menuView.layer.shadowOffset = CGSizeMake(0.0f, 0.5f);
self.menuView.layer.shadowOpacity = 0.75f;
self.menuView.layer.shadowPath = shadowPath.CGPath;