Skip to content

Instantly share code, notes, and snippets.

View ohayon's full-sized avatar

David Ohayon ohayon

View GitHub Profile
@ohayon
ohayon / messages_controller.rb
Created November 12, 2012 02:50
trying to change action of button
def create
@message = Message.new(params[:message])
account_sid = 'AC99a8b8ee9bba15e33ee4cac8bb0e505a'
auth_token = 'f1adcf3b638369e574662fcad40e60f5'
if @message.save
begin
client = Twilio::REST::Client.new account_sid, auth_token
client.account.sms.messages.create(
def index
if params(:state) == used
@coupons = Coupon.all(params[:state])
else
@coupons = Coupon.all
end
respond_to do |format|
format.html # index.html.erb
format.json { render json: @coupons }
@ohayon
ohayon / MyLocation.m
Created December 23, 2012 21:33
Ray Wenderlich's MapKit Tutorial
//
// MyLocation.m
// MapTutorial
//
// Created by David Ohayon on 12/22/12.
// Copyright (c) 2012 David Ohayon. All rights reserved.
//
#import "MyLocation.h"
#import <AddressBook/AddressBook.h>
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
#import "AFJSONRequestOperation.h"
#import <SSToolkit/SSToolkit.h>
@interface DOViewController : UIViewController<CLLocationManagerDelegate, UITableViewDelegate, UITableViewDataSource>{
CLLocationManager* _locationManager;
}
@ohayon
ohayon / gist:5657895
Created May 27, 2013 16:22
CocoaPods No matter what I do, changing file extensions, the podspec file, etc. When I run `pod spec lint` it passes validation, but then prints `Unable to read the license file ` twice. Thanks for the help.
~/Code/iOS/AFRedditAPIClient
‣ pod spec lint --verbose master
> AFRedditAPIClient
AFRedditAPIClient (0.0.2) - Analyzing on iOS 5.0 platform.
Analyzing dependencies
Fetching external sources
### Keybase proof
I hereby claim:
* I am ohwutup on github.
* I am ohayon (https://keybase.io/ohayon) on keybase.
* I have a public key whose fingerprint is A7A6 8AD5 C55C 681B A30F A9D8 0BCF 969E B879 FB41
To claim this, I am signing this object:
@ohayon
ohayon / gist:f6aefd26cfd0ca8f35b1
Created December 7, 2015 22:11
Bundler Error
Environment
Bundler 1.10.6
Rubygems 2.4.5
Ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
Git 2.4.2.740.g0ae71d1-twtrsrc
Gemfile
source 'https://rubygems.org'

Keybase proof

I hereby claim:

  • I am ohayon on github.
  • I am ohayon (https://keybase.io/ohayon) on keybase.
  • I have a public key ASCHvqOTfRRij1bAMobMuyf0cgzDkrY0cPYMD54FWSs1dwo

To claim this, I am signing this object:

@ohayon
ohayon / init.lua
Created March 29, 2018 16:23
hammerspoon config
SHOULD_HIDE_ON_DEACTIVATE = true
function applicationWatcher(appName, eventType, appObject)
if (eventType == hs.application.watcher.deactivated) then
if (appName == "Terminal") then
if (SHOULD_HIDE_ON_DEACTIVATE == true) then
appObject:selectMenuItem({"Terminal", "Hide Terminal"})
end
end
end
end
@ohayon
ohayon / DraggableView.swift
Last active April 5, 2023 16:24
Example of making a reusable `draggable()` modifier for SwiftUI Views
struct DraggablePita: View {
var body: some View {
Image(uiImage: UIImage(named: "pita.png")!)
.draggable() // Add the new, custom modifier to make this draggable
}
}
// Handle dragging
struct DraggableView: ViewModifier {
@State var offset = CGPoint(x: 0, y: 0)