Skip to content

Instantly share code, notes, and snippets.

@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active December 20, 2022 22:49
Installing ElasticSearch on Ubuntu 14.04
View ElasticSearch.sh
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@ricardo-rossi
ricardo-rossi / maven-333.sh
Last active September 17, 2020 09:42 — forked from ervinb/maven-333.sh
Install Maven 3.3.3 on Ubuntu 14.04
View maven-333.sh
#!/bin/sh
sudo apt-get purge -y maven
if ! [ -e apache-maven-3.3.3-bin.tar.gz ]; then (curl -OL http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz); fi
sudo tar -zxf apache-maven-3.3.3-bin.tar.gz -C /usr/local/
sudo ln -s /usr/local/apache-maven-3.3.3/bin/mvn /usr/bin/mvn
echo "Maven is on version `mvn -v`"
@ricardo-rossi
ricardo-rossi / chart.cljs
Created April 18, 2017 19:42
Chart Component
View chart.cljs
(ns om-data-vis.chart
(:require-macros [cljs.core.async.macros :refer [go go-loop]])
(:require [om.core :as om :include-macros true]
[cljs.core.async :refer [<! chan put! sliding-buffer]]
[ajax.core :refer (GET)]
[sablono.core :as html :refer-macros [html]]))
(defn- draw-chart [cursor {:keys [div bounds x-axis y-axis plot]}]
(let [{:keys [id width height]} div
Chart (.-chart js/dimple)
@ricardo-rossi
ricardo-rossi / routing.cljs
Created April 18, 2017 19:38
CLJS Routing
View routing.cljs
defresource contact [handlers]
:allowed-methods #{:delete :put}
:available-media-types #{"application/json"}
:handle-ok (fn [{{{id :id} :route-params routes :routes} :request}]
(assert (realized? handlers))
(html [:div [:h2 "Contact: " id]
[:a {:href (path-for routes (:contacts @handlers))} "Index"]])))
(defn make-handlers [database]
(let [p (promise)]
@ricardo-rossi
ricardo-rossi / typeahead.cljs
Created April 18, 2017 19:22
ReactJS Component for type ahead
View typeahead.cljs
(defn typeahead [data owner]
(reify
om/IInitState
(init-state [_] {:text ""})
om/IRenderState
(render-state [_ {:keys [text]}]
(let [words (:words data)]
(dom/div nil
(dom/h2 nil "Tag")
(dom/input
@ricardo-rossi
ricardo-rossi / build.sh
Created December 21, 2015 22:49 — forked from patrickarlt/build.sh
ES 7 async/await demo!
View build.sh
babel github-es6.js -o github.js --optional runtime --experimental
@ricardo-rossi
ricardo-rossi / gist:fd15902864d47696b9d5
Last active August 29, 2015 14:10
Pretty git log script
View gist:fd15902864d47696b9d5
#!/bin/sh
while true;
do
clear
git log \
--graph \
--all \
--color \
--date=short \
-40 \
View Nutrient.php
<?php
class Nutrient extends BaseModel {
protected $guarded = array();
public static $rules = array(
'name' => 'required',
'unit' => 'required'
);
View IngredientTypesController.php
<?php
class IngredientTypesController extends BaseController {
/**
* Ingredient Types Repository
*
* @var IngredientType
*/
protected $type;
@ricardo-rossi
ricardo-rossi / MailingList.php
Created September 18, 2014 19:50
This class handles adding new users our MailChimp mailing list as well as updating the list entry based on actions
View MailingList.php
<?php namespace Endata\Lists;
use MailChimp;
use Carbon\Carbon;
class MailingList {
protected $mailchimp;
protected $list_id = 'MCIDXXX'; // The MailChimp list id