Skip to content

Instantly share code, notes, and snippets.

@matteodepalo
matteodepalo / question.rb
Created January 5, 2013 15:14
question elasticsearch mapping
include Tire::Model::Search
include Tire::Model::Callbacks
settings :analysis => {
:filter => {
:ngram_filter => {
:type => 'edgeNGram',
:min_gram => 1,
:max_gram => 10,
:side => 'front'
@matteodepalo
matteodepalo / fish_prompt.fish
Created November 7, 2013 15:46
fish_prompt.fish
set fish_git_dirty_color red
set fish_git_branch_color purple
set fish_ruby_version_color yellow
function prompt_git_dirty
git diff > /dev/null 2>&1
if test $status != 0
echo ' ✗'
end
end
# Outputs this at warn log level:
# 1.2.3.4 GET /path 200 OK BlahController#action HTML 938.2 (DB 11.8, View 719.7) {params} {optional params from flash[:log]}
#
# Save as config/initializers/oneline_detailed_logging.rb. Consider
# decreasing the log level from "info" to "warn" (in production.rb) so
# the one-line log message replaces the standard request logs.
# override process_action to add 2 things to the payload:
# - remote IP
$width: 480px
.sliding-panel
+box-shadow(-1px 1px 2px rgba(0,0,0,.3))
+animation(slide 0.5s forwards)
position: fixed
bottom: 0
top: 0
right: -$width
z-index: 100
@matteodepalo
matteodepalo / front-end-challenge.md
Last active August 29, 2015 14:04
Front-End Challenge

Front-End Challenge

The setting

We want to pay one of our advisors. We direct him to a page where he can see he's going to be paid $100. At the bottom of the page he will be able to choose if a part of his earnings will go to charity.

The challenge

Implement with html, css and js the following radio buttons selection.

defmodule GosugamersParser do
use Hound.Helpers
require Logger
def start do
events_urls
|> Enum.map(&Task.async(fn -> fetch_tournaments(&1) end))
|> Enum.map(&Task.await(&1, 100000))
|> List.flatten
|> Enum.map(&IO.puts/1)
import Ember from 'ember';
export default Ember.Component.extend({
value: 'test',
printValue: Ember.observer('value', function() {
console.log(this.get('value'))
}),
actions: {
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Matteo Depalo",
"label": "Senior Software Engineer",
"image": "",
"email": "matteo+resume@depalo.me",
"phone": "+447751443392",
"url": "",
"location": {
@matteodepalo
matteodepalo / example1.ts
Last active April 12, 2023 09:43
Code example 1
renderSuccess({
headline: 'Deployment successful.',
body: 'Your extensions have been uploaded to your Shopify Partners Dashboard.',
nextSteps: [
{
link: {
label: 'See your deployment and set it live',
url: 'https://partners.shopify.com/1797046/apps/4523695/deployments',
},
},
@matteodepalo
matteodepalo / example2.tsx
Last active April 12, 2023 09:50
Code example 2
const ARROW_DOWN = '\u001B[B'
const ENTER = '\r'
describe('SelectPrompt', async () => {
test('choose an answer', async () => {
const onEnter = vi.fn()
const items = [
{label: 'first', value: 'first'},
{label: 'second', value: 'second'},