Skip to content

Instantly share code, notes, and snippets.

View mittsh's full-sized avatar
🇪🇪
Tallinn, Estonia

Micha Mazaheri mittsh

🇪🇪
Tallinn, Estonia
View GitHub Profile
@mittsh
mittsh / index.html
Last active December 21, 2015 17:09
Ember.js: Easy setup to set document title + having a heading view containing the same title using a subclass of Ember.Route
<script type="text/x-handlebars" data-template-name="title">
{{view.title}}
</script>
<script type="text/x-handlebars">
<header class="topbar">{{view App.TitleView}}</header>
</script>
@mittsh
mittsh / LMWindow.m
Created September 23, 2013 10:11
How to debug your key view loop: highlights
/*
* Copyright (c) 2013 Micha Mazaheri
* Released under the MIT License: http://opensource.org/licenses/MIT
*/
#define LMWindowDEBUGResponders
#ifdef LMWindowDEBUGResponders
static BOOL _showFirstResponderOverlay = YES;
#endif
@mittsh
mittsh / README.md
Last active March 4, 2024 01:41
Add "Open in Paw" for Mashape APIs

Example

Check an example

Steps

1. Add the "Open in Paw" link below

<a href="paw://current.document/requests/import?directoryapi_id=mashape.{MASHAPE_API_AUTHOR}.{MASHAPE_API_ID}" data-paw-api-name="{API_NAME}">Open in Paw</a>
@mittsh
mittsh / challenge.md
Last active August 29, 2015 14:20
Paw Coding Challenge #1

Paw Coding Challenge

English

Count the N most frequent words

You get N words, your goal is to find the k most frequent words.

Input

@mittsh
mittsh / dv.js
Last active August 29, 2015 14:21
Get a response value and increment
function evaluate(context){
// get response body
var responseBody = context.getCurrentRequest().getLastExchange().responseBody;
// parse JSON
var jsonDict = JSON.parse(responseBody);
// access the value we need
var value = jsonDict.id; // e.g. access the "id" field
@mittsh
mittsh / README.md
Created September 10, 2015 18:46
Find pictures from a directory and move them somewhere else (useful to find pictures from an iOS backup)

Find pictures from a directory and move them somewhere else (useful to find pictures from an iOS backup)

$ python findpic.py --rename --copy DESTINATION_DIR SOURCE_DIR
@mittsh
mittsh / js-lisp.md
Last active September 13, 2015 23:34

Teach JS to do Lisp-like additions

var f = function(x) {
  return function(y) {
    if (y === 0) {
      return x;
    } else {
      return f(x + y);
 }
{
"@context": "http://json-ld.org/contexts/person.jsonld",
"@id": "http://dbpedia.org/resource/John_Lennon",
"name": "John Lennon",
"born": "1940-10-09",
"spouse": "http://dbpedia.org/resource/Cynthia_Lennon"
}
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Artist",
"description": "An artist from our database",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for an artist",
"type": "integer"
},
@mittsh
mittsh / README.md
Last active March 19, 2018 18:00
Convert WADL file to Swagger to import in Paw

Import WADL definitions to Paw

  1. Make sure your WADL file is in the same directory under the name wadl.xml.

  2. Then, you can just run:

npm install
node wadl2swagger.js