Skip to content

Instantly share code, notes, and snippets.

@3lvis
3lvis / pexip.json
Last active November 1, 2020 09:44
[
{
"id": "5f9e815c8e25c6bf8560cafb",
"start_date": "2020-12-15T11:00:00 -01:00",
"end_date": "2020-12-15T12:00:00 -01:00",
"name": "TOYLETRY",
"friends": [
{
"id": 0,
"name": "Patrick Smith",
[
{
"_id": "5a4f4635c8e945ce7d435ae2",
"index": 0,
"guid": "c39233a4-b90f-4cf4-a759-eb378b7671e6",
"isActive": false,
"balance": "$2,632.67",
"picture": "http://placehold.it/32x32",
"age": 30,
"eyeColor": "blue",
@3lvis
3lvis / discover.json
Created October 2, 2017 09:03
Discover JSON
This file has been truncated, but you can view the full file.
{
"size": 5957,
"items": [
{
"image": {
"scalable": true,
"width": 1600,
"type": "GENERAL",
"url": "2017/9/vertical-5/30/5/105/424/_1263219766.jpg",
import UIKit
import PlaygroundSupport
class CustomLabel: UILabel {
var topInset: CGFloat = 2.25
var bottomInset: CGFloat = 2.25
override func drawText(in rect: CGRect) {
let insets = UIEdgeInsets(top: topInset, left: 0, bottom: bottomInset, right: 0)
super.drawText(in: UIEdgeInsetsInsetRect(rect, insets))
@3lvis
3lvis / GHDiff-HidePods.js
Last active February 13, 2017 11:41 — forked from AliSoftware/GHDiff-HidePods.js
Hide Pods/* related files in a GitHub diff page
// When you are in the diff page of a GitHub PR
// And want to hide all the Pods/* files in that diff page, use this:
// Paste that in your Web Inspector's console
var nodes = document.evaluate("//div[@class='file-header' and starts-with(@data-path,'Carthage/')]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null );
for(i=0; i<nodes.snapshotLength; ++i) {
nodes.snapshotItem(i).parentNode.hidden = true
}
// Or even better, create a bookmark with this code for easy quick access:
{
"feed": {
"author": {
"name": {
"label": "iTunes Store"
},
"uri": {
"label": "http://www.apple.com/itunes/"
}
},

Hi!

Description

My goal was to make something somewhat inspired by the Yahoo News Digest app, then I realized that not having pictures could be an issue with the personality of the articles, a simple list of text will look to serious and not fun to read. My approach was to give some life to the list by using different colors based on the index of the article.

Process

import UIKit
import XCPlayground
let containerWidth = CGFloat(320)
let containerHeight = CGFloat(568)
//***************************
//***************************
//****** Basic set up *******
//***************************
public func drop() throws {
guard let store = self.persistentStoreCoordinator.persistentStores.last, storeURL = store.URL, storePath = storeURL.path
else { throw NSError(info: "Persistent store coordinator not found", previousError: nil) }
let sqliteFile = (storePath as NSString).stringByDeletingPathExtension
let fileManager = NSFileManager.defaultManager()
self._writerContext = nil
self._mainContext = nil
self._persistentStoreCoordinator = nil
class func dataStackWithModelName(modelName: String) -> DATAStack {
let bundle = NSBundle(forClass: Helper.self)
let dataStack = DATAStack(modelName: modelName, bundle: bundle, storeType: .SQLite)
return dataStack
}