This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ListeningSocketCallback(CFSocketRef sock, | |
CFSocketCallBackType type, CFDataRef address, const void *data, | |
void *info) | |
{ | |
int fd = * (const int *) data; | |
CFReadStreamRef readStream; | |
CFWriteStreamRef writeStream; | |
NSInputStream * inputStream; | |
NSOutputStream * outputStream; | |
CFStreamCreatePairWithSocket(NULL, fd, &readStream, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shows latest news from MacStories in a table. | |
// The table shows an image from the article, if available, and the title of the article. | |
let numberOfArticles = URLScheme.parameter("number") | |
let url = "https://macstories.net/feed/json" | |
let shjortifyURL = "shortifyactions2:///addJSON?" | |
var jsonData = {"items": []} | |
let req = new Request(url) | |
let json = await req.loadJSON() | |
let items = json.items |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UITableViewController { | |
private let kTableViewHeaderHeight: CGFloat = 300.0 | |
var headerView: UIView! | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let clientID = '<client_id>' | |
let clientSecret = '<client_secret>' | |
let cred = clientID + ':' + clientSecret | |
let credEncoded = Data.fromString(cred).toBase64String() | |
let auth = 'Basic ' + credEncoded | |
// Get token | |
let tokenURL = 'https://accounts.spotify.com/api/token' | |
var reqToken = new Request(tokenURL) | |
reqToken.method = 'POST' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Base64 encoding of your credentials | |
let clientID = '<your client id>' | |
let clientSecret = '<your client secret>' | |
let cred = clientID + ':' + clientSecret | |
let credEncoded = Data.fromString(cred).toBase64String() | |
let auth = 'Basic ' + credEncoded | |
// Get token | |
let tokenURL = 'https://accounts.spotify.com/api/token' | |
var reqToken = new Request(tokenURL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iphone = new Layer( | |
width: 320 | |
height: 568 | |
backgroundColor: "#fff" | |
) | |
iphone.center() | |
iphone.scroll = true | |
header = new Layer( | |
width: iphone.width | |
height: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# responsive.coffee | |
# Lorenzo Ferrante 2014 | |
# Width variable | |
width60 = Screen.width / 1.66 # width: 60% -> Default | |
width80 = Screen.width / 1.25 # width: 80% | |
width90 = Screen.width / 1.11 # width: 90% | |
# Reload page when screen is resized | |
window.addEventListener "resize", (event) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,300); | |
body { | |
background-image: url('http://www.glasscollective.com/img/pw_maze_white.png'); | |
} | |
#container { |
NewerOlder