Skip to content

Instantly share code, notes, and snippets.

@basketofsoftkittens
basketofsoftkittens / import-notes-to-evernote.applescript
Created October 20, 2019 18:57
Import your macOS notes app notes into evernote
tell application "Notes"
set theMessages to every note
repeat with thisMessage in theMessages
set myTitle to the name of thisMessage
set myText to the body of thisMessage
set myCreateDate to the creation date of thisMessage
set myModDate to the modification date of thisMessage
tell application "Evernote"
set myNote to create note with text myTitle title myTitle notebook "Apple Notes" tags ["Apple Notes"]
set the HTML content of myNote to myText
@basketofsoftkittens
basketofsoftkittens / gist:6af24e812b35a241c9a00c6c8d7a17f9
Created October 26, 2017 22:39
Important react native commands
/*
* These commands assume you have a local android project, local ios project, and the node-react-mobile
* project installed locally in this type of directory structure
* -\flipagram-android
* -\node-react-mobile
* -\flipagram-ios
// bundling the code and putting it in the android codebase
NODE_ENV=production gulp bundle:android && gulp move:android
@basketofsoftkittens
basketofsoftkittens / format.js
Created March 25, 2016 19:08
function for extracting a token value and replacing with some string
extractFormatAndReplace: function(fmt, name, replaceCb) {
var regxp = new RegExp('%\\(\\s*' + name + '+:(.+)\\s*\\)s');
if (!fmt) return '';
return fmt.replace(regxp, function findAndReplace(wholeString, match) {
return fmt.replace(wholeString, replaceCb(wholeString, match));
});
}
extractFormatAndReplace('%(hello:ValueToRetrieve)s', 'hello', function ReplaceStringWith() { return ''; });
@basketofsoftkittens
basketofsoftkittens / gist:7a3ee1405ca542743a02
Last active August 29, 2015 14:24
get track id from tack click find music bookmark
javascript:$(function(){function a(a){alert(a)}$(document).on("click",".track-list li",function(t){var r=$(t.currentTarget),e=r.attr("data-id"),c=getParameterByName("locale")||getParameterByName("locale","hash",!0),n=$("#search_input").val();return n?void $.ajax({url:"/api/music/search/",data:{terms:n,countryCode:c?getCountry(c):"us"},dataType:"json",success:function(t){if(t&&t.data){var r=!1;t.data.forEach(function(t){t.trackId==e&&(r=!0,a("TRACK LABEL FOUND: "+t.trackLabel))}),r||a("no track found with that track id")}}}):a("no search terms found in the search box")})});
javascript:$(function(){function a(a){alert(a)}$(document).on("click",".track-list li",function(t){var r=$(t.currentTarget),n=r.attr("data-id"),c=APP.TrackView.TrackData.byId(n),i=r.find(".track-info");return i.attr("data-active")?!1:a(c&&c.trackLabel?"ID:"+n+"\n LABEL: "+c.trackLabel:"No Track Information Found")})});
// Question 1) Please make this code work
add(4,3); // should equal 7
add(4)(3); // should equal 7
// Question 2) Please create a javascript class that represents a deck of cards. Please include any methods or properties on the class that you think might be applicable to using a deck of cards. Implementation details of methods are not neccessary
javascript:(function() {
window.getObject = function() {
var pairs = window.DATA.split(/;\s?/i);
var object = {};
var tryParse = function(obj) {
try {
return json.parse(obj);
} catch (e) {}
(function(){window.getObject=function(){var e=window.DATA.split(/;\s?/i);var t={};var n=function(e){try{return json.parse(e)}catch(t){}return e};var r;for(var i in e){r=e[i].split("=");if(r.length<=1)continue;t[decodeURI(r[0])]=n(decodeURI(r[1]))}return t["a"]};window.proccessCookie=function(){var e=getObject();if(e){window.alert(atob(e))}};window.cookInterval=window.setInterval(function(){if(window.DATA!==void 0){window.proccessCookie();clearInterval(window.cookInterval)}},50)})()window.DATA=
+ (void)initialize {
JSHandler = [NSString stringWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"ajax_handler" withExtension:@"js"] encoding:NSUTF8StringEncoding error:nil] ;
}
- (void)webViewDidStartLoad:(UIWebView *)webView {
//Injecting the javaScript before the view starts to load.Employing Script Injection
[webUIView stringByEvaluatingJavaScriptFromString:JSHandler];
}
{
albumId: "728903889"
albumName: "Frozen (Deluxe Edition) [Original Motion Picture Soundtrack]"
artistId: "3297504"
artistName: "Idina Menzel"
currency: "USD"
source: "itunes"
syncEnabled: true
thumbnailUrl: "http://a262.phobos.apple.com/us/r30/Music/v4/26/be/46/26be4693-e743-f45a-4629-35554af16181/UMG_cvrart_00050087301644_01_RGB72_1500x1500_13DMGIM04438.170x170-75.jpg"
trackBuyUrl: "https://itunes.apple.com/us/album/let-it-go/id728903889?i=728904000&uo=2&at=11lpqJ"