Skip to content

Instantly share code, notes, and snippets.

View craiem's full-sized avatar

craiem

View GitHub Profile
@craiem
craiem / manually-validate.js
Created March 26, 2013 14:00 — forked from martinnormark/manually-validate.js
Js -> Validate Form
validate: function () {
var form = this.$el.is("form") ? this.$el : this.$el.closest("form");
if (!form.is("form")) {
form = this.$el.find("form");
}
return form.data().unobtrusiveValidation.validate();
}
@craiem
craiem / google-image-search.php
Created March 24, 2013 01:11 — forked from susanBuck/google-image-search.php
php -> Google image Search
<?php
# This grabs the keyword off the url -- index.php?keyword=Clouds
$keyword = $_GET['keyword'];
# Only do this if we've already passed in a keyword (i.e. it's not blank)
if($keyword != "") {
# Load the data from Google via cURL
$curl_handle = curl_init();
curl_setopt($curl_handle,CURLOPT_URL,"http://ajax.googleapis.com/ajax/services/search/images?v=1.0&imgsz=xlarge&q=".urlencode($keyword));
@craiem
craiem / detectMobile.js
Created March 24, 2013 01:06 — forked from keriati/detectMobile.js
js -> DetectMobile
// Bad practice!
function detectMobile() {
return (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
}