Skip to content

Instantly share code, notes, and snippets.

@dshaw002
dshaw002 / download.sh
Created July 31, 2017 19:54 — forked from bittlingmayer/download.sh
Download fastText pre-trained models for many languages
# See https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md
for (( i=1; i<=$#; i++ )); do
wget -c "https://s3-us-west-1.amazonaws.com/fasttext-vectors/wiki.${!i}.zip"
done
# For example:
# ./download.sh bg el ka hy ru fa es fr de it pt ar tr pl ko
# If stopped it will not re-start automatically, but if re-started it will continue from where it stopped.
var gulp = require('gulp'),
gulpWatch = require('gulp-watch'),
del = require('del'),
runSequence = require('run-sequence'),
argv = process.argv;
/**
* Ionic hooks
* Add ':before' or ':after' to any Ionic project command name to run the specified
var gulp = require('gulp'),
gulpWatch = require('gulp-watch'),
del = require('del'),
runSequence = require('run-sequence'),
argv = process.argv;
gulp.task('serve:before', ['watch']);
gulp.task('emulate:before', ['build']);
gulp.task('deploy:before', ['build']);
gulp.task('build:before', ['build']);
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: text/html; charset=utf-8");
$data = array(
'from' => '[email protected]',
'to' => '[email protected]',
'subject' => '',
'text' => ""
);
@dshaw002
dshaw002 / gist:d8891ae3612a5556314b
Created March 8, 2016 15:46
Notes on Searching for file metadata through lots of directories!
Problem: Need to search files in subdirectory for metadata
Solution:
1) Find files and matches and output to data file
a) Use find to get loop of files..
b) identify -verbose to get metadata of files..
c) grep to get lines around match..
d) cat to output it to results file
2) Make sense of response data
@dshaw002
dshaw002 / gist:639e2f3dab1e9a2a7ed4
Created December 28, 2015 00:24
Sharing a folder in Dropbox
Step 1 - Sharing/Share Folder
https://api.dropboxapi.com/2/sharing/share_folder
{
"path": {your path},
"force_async": false,
"acl_update_policy": "editors"
}
it returns the shared folder id in the root as shared_folder_id
$('html').click(function(){
// Hide Menus if visible
$('#yourMenuName').hide();
});
$('html').on('submit', '#form2', function(e){
e.preventDefault();
$('#yourOverlayName').show();
});
@dshaw002
dshaw002 / functions.php
Created December 16, 2013 20:55
Wordpress AJAX
//of your theme...
function test_ajax()
{
$pass = "empty";
if( isset( $_POST['passthrough'] ) ){ $pass = $_POST['passthrough']; }
die( json_encode( array("result"=>"true", "vars" => $pass) ) );
}
add_action( 'wp_ajax_nopriv_test_ajax', 'test_ajax' ); // if user is not logged in
@dshaw002
dshaw002 / gist:7033528
Created October 17, 2013 22:34
UserAgent Detection
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
@dshaw002
dshaw002 / gist:5364878
Created April 11, 2013 16:26
Changing text fields on focus / blur, etc.
<!--for HTML5 / modern browsers-->
<input name="name" placeholder="Enter Name" value="" />
<!--for newer browsers-->
<input name="name" value="Enter Name" onfocus="if(this.value=='Enter Name')this.value='';" onblur="if(this.value=='')this.value='Enter Name';" />