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: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
let urlPath = "http://www.telize.com/geoip" | |
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
// | |
// ViewController.swift | |
// DaysUntilDate | |
// | |
// Created by Scotty Moon on 8/31/14. | |
// Copyright (c) 2014 Scotty Moon. All rights reserved. | |
// | |
import UIKit |
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
#/usr/bin/ruby | |
WATER = 22.2593 | |
WATER_MEASUREMENT = "ml" | |
COFFEE = 0.04493 | |
COFFEE_MEASUREMENT = "g" | |
def get_water_weight(coffee) | |
(coffee.to_f * WATER).ceil.to_s + WATER_MEASUREMENT | |
end |
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
{ | |
"total_pages": 5, | |
"page": { | |
"number": 1, | |
"content": [ | |
{ | |
"type": "text", | |
"value": "Aliquam ut dui eu purus ultrices mollis. Nullam mattis, leo vitae accumsan rhoncus, nisl urna tincidunt lacus, ac fermentum ante neque at metus. Sed at eros hendrerit, lacinia augue et, facilisis velit. Praesent est metus, faucibus id mi quis, aliquet tempus urna. Suspendisse pellentesque <b>leo ut ligula luctus</b> ultrices. Sed at ultrices velit. In et leo turpis. Duis accumsan ante non nunc elementum, vitae dapibus metus pellentesque. Cras id tempor eros. Vivamus et scelerisque eros, sit amet laoreet lorem. <br/> Curabitur nisi nulla, congue et enim et, iaculis dictum lacus. Mauris id libero neque. Nulla condimentum dignissim nunc rhoncus mattis. Sed pellentesque nec ante at aliquam. Aliquam et dignissim ante. Sed sed tellus non turpis lacinia rutrum sit amet sit amet ligula. Integer enim mauris, ornare ut dapibus in, tempor ac justo. Donec condimentum sit amet metus eget euismod. Donec hen |
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
public class MainActivity extends Activity implements View.OnClickListener { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
Button clickMe = (Button) findViewById(R.id.button_name); | |
clickMe.setOnClickListener(this); | |
} | |
@Override | |
public void onClick(View view) { |
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
function ThingController($scope, $http) { | |
var baseUrl = 'http://sinatra-api-example.scottymoon.c9.io'; | |
$http.get(baseUrl + '/things').success(function(data) { | |
$scope.things = data; | |
}); | |
$scope.create = function(thing) { | |
$http.post(baseUrl + '/things', thing).success(function(thing){ | |
$scope.things.unshift(thing); |
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
<!DOCTYPE html> | |
<html lang="en" ng-app> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sinatra JSON API Example</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js"></script> | |
<script src="/controllers.js"></script> | |
</head> | |
<body ng-controller='ThingController'> |
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
#application.html.haml | |
%html(ng-app) | |
#event.js | |
function EventCtrl($scope){ | |
$scope.current_user = { | |
name: "Scotty Moon", | |
email: "[email protected]" | |
} |
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
module PgSearchable | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
module ClassMethods | |
def searchable_on(*args) | |
@@search_columns = args | |
end |
NewerOlder