View gist:5470218
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 checkFile(file) { | |
var extension = file.substr((file.lastIndexOf('.') +1)); | |
if (!/(pdf|zip|doc)$/ig.test(extension)) { | |
alert("Invalid file type: "+extension+". Please use DOC, PDF or Zip."); | |
$("#file").val(""); | |
} | |
} |
View gist:2501891
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
<?php | |
class Encryption { | |
var $skey = "yourSecretKey"; // change this | |
public function safe_b64encode($string) { | |
$data = base64_encode($string); | |
$data = str_replace(array('+','/','='),array('-','_',''),$data); | |
return $data; | |
} |
View ExplorerHotKey.ahk
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
*#e:: | |
Run C:\Program Files (x86)\XYplorer\XYplorer.exe | |
return |
View gist:843202
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/env ruby | |
/* Thanks to @TextMateUser for help with this. */ | |
/* Escape quotes */ | |
puts STDIN.readlines.collect{|line| line.gsub('"','\\"')} | |
/* Remove escaping */ | |
puts STDIN.readlines.collect{|line| line.gsub('\\"','"')} |
View gist:2003485
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
<?php | |
/* | |
test.php | |
Proof of concept testing to see if we can get | |
PHP/SOAP talking to EWS. Thanks to Thomas Rabaix | |
for his documentation on NTLM auth in SOAP and to | |
Erik Cederstrand for his article on SOAP/Exchange. |
View gist:5716548
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
<?php | |
// search model for matching key | |
$record = FormDB::find('blah@blah.com'); | |
if($record) { | |
// record exists, update data | |
$record->text = "Updated"; | |
$record->save(); | |
} else { |
View 020_add_android_permissions.js
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
/* | |
This script uses as a cordova hook and provides ability to add android permissions to AndroidManifest.xml on the fly. It also | |
checks and computes which of provided permissions are already added and didn't rewrite AndroidManifest.xml if no permissions provided. | |
Executes only for android platform. | |
Prerequirements: | |
- node 4.2+ | |
- npm modules: lodash, xml2js | |
Distributed under the MIT license. |
View DOSKEY.cmd
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
@echo off | |
DOSKEY clear=cls | |
DOSKEY ls=dir |
View template.html
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"> | |
<head> | |
<!-- Meta yo --> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>My Boostrap Page</title> |
View getAccurateCurrentPosition.js
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
navigator.geolocation.getAccurateCurrentPosition = function (geolocationSuccess, geolocationError, geoprogress, options) { | |
var lastCheckedPosition, | |
locationEventCount = 0, | |
watchID, | |
timerID; | |
options = options || {}; | |
var checkLocation = function (position) { | |
lastCheckedPosition = position; |
NewerOlder