Skip to content

Instantly share code, notes, and snippets.

View amitaibu's full-sized avatar

Amitai Burstein amitaibu

View GitHub Profile
'use strict';
angular.module('yourApp')
.constant('Config', {
view_dir: 'views/',
API: {
useMocks: true,
fakeDelay: 2000,
protocol: window.location.protocol.split(':')[0],
host: window.location.hostname,
@amitaibu
amitaibu / index.html
Last active August 29, 2015 14:12 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="http://snapsvg.io/assets/js/snap.svg-min.js"></script>
<style id="jsbin-css">
#svgout {
height: 600px;
}
@amitaibu
amitaibu / imgur
Last active August 29, 2015 14:12 — forked from vivien/imgur
#!/bin/sh
#
# Upload image(s) to imgur.com
# Copyright (C) 2014 Vivien Didelot <[email protected]>
# Licensed under GPL version 3, see http://www.gnu.org/licenses/gpl.txt
#
# Requires "jshon":
# http://kmkeen.com/jshon/
#
# Alternatives, which suck:
angular.module('hf.events.builder', [
'app.resources',
'app.values'
])
.factory('EventBuilder', function ($injector, $window, apiUrl) {
var EventBuilder = function EventBuilder(message) {
this['@timestamp'] = new Date();
this['@message'] = message || '';
return this;
};
# Varnish caching
## List of 300 items
Requests per second: 6717.35 [#/sec] (mean) # RESTful Memcache render cache.
Requests per second: 7096.14 [#/sec] (mean) # RESTful Database render cache.
Requests per second: 6379.45 [#/sec] (mean) # RESTful No render cache.
Requests per second: 95.24 [#/sec] (mean) # RESTWS
Requests per second: 1125.62 [#/sec] (mean) # Services
## List of 50 items
Requests per second: 6632.03 [#/sec] (mean) # RESTful Memcache render cache.
Requests per second: 7057.74 [#/sec] (mean) # RESTful Database render cache.
@amitaibu
amitaibu / .travis.yml
Created April 17, 2016 09:04 — forked from iamEAP/.travis.yml
Template for integrating Travis-CI and Pantheon Multidev
language: php
#
# Important to note, this is the version of PHP used to run this build, not the
# one used to run your Drupal installation. Ensure compatibility with the Drush
# and Terminus versions you're using for this build.
#
php:
- 5.3
@amitaibu
amitaibu / Main.elm
Created May 14, 2017 18:22 — forked from anonymous/Main.elm
contacts page
module Main exposing (..)
import Html exposing (Html, div, li, text, ul)
main : Html a
main =
div []
[ div [] [ text <| "Showing contacts for language " ++ toString model.language ]
, viewContacts model.language model.contacts
@amitaibu
amitaibu / Main.elm
Created May 15, 2017 18:19 — forked from anonymous/Main.elm
contacts page
module Main exposing (..)
import Html exposing (Html, div, li, text, ul)
import Json.Decode as Json exposing (Decoder, andThen, at, fail, int, list, map, nullable, string, succeed)
import Json.Decode.Pipeline exposing (custom, decode, hardcoded, optional, required)
import String exposing (join)
main : Html a
main =
@amitaibu
amitaibu / gist:4427e2319ebc3d8aa0bcd9264270e6f3
Last active March 19, 2024 15:26 — forked from djazayeri/gist:d3dc89988486fe6f988d
Example of using OpenMRS REST to create a patient and an encounter (in OpenMRS 2.1)
// go to https://demo.openmrs.org, log in as admin/Admin123, open the JavaScript console, and do the following:
var URL_BASE = "https://demo.openmrs.org/openmrs/ws/rest/v1/";
var resources = {};
function andLog(data) { console.log(data); }
function andSaveAs(variable) { return function(data) { resources[variable] = data; console.log(variable + " => " + JSON.stringify(data)); } }
function andSaveFirstResultAs(variable) { return function(data) { data = data.results[0]; resources[variable] = data; console.log(variable + " => " + JSON.stringify(data)); } }
function random() { return Math.floor(Math.random() * 10000); }
function post(resource, data, success) {
$.ajax({ type: "POST", url: URL_BASE + resource, contentType: "application/json", data: JSON.stringify(data), success: success });