Skip to content

Instantly share code, notes, and snippets.

View pasikonik's full-sized avatar
🍏
Go vegan!

Michał Olejniczak pasikonik

🍏
Go vegan!
  • Poznań
  • 08:13 (UTC -12:00)
View GitHub Profile
import Ember from 'ember';
const $ = Ember.$;
function triggerNativeEvent(element, eventName) {
const event = new Event(eventName);
element.dispatchEvent(event);
}
export default function(element, date) {
const day = date.getDate();
#!/usr/bin/env ruby
require 'pry'
require_relative './app/app'
Pry.start
@pasikonik
pasikonik / nginx.conf
Last active December 23, 2018 11:08
Nginx configuration for Rails API only
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream app {
server unix:/var/www/hajsapp/shared/sockets/puma.sock;
}
// get the id of the author without triggering a request
var authorId = post.belongsTo("author").id();
@pasikonik
pasikonik / unique_sum_on_hash.rb
Last active April 11, 2019 12:48
ruby magick
users_summary.group_by { |s| s[:user] }.map do |user, value|
{ user: user, dailySummary: value.inject(0) { |s, h| s + h[:dailySummary] } }
end
defmodule People do
def list(people) do
if Kernel.length(people) == 1 do
Enum.at(people, 0)[:name]
else
Enum.map(people, fn person -> person[:name] end)
|> Enum.join(", ")
|> String.replace(~r/,([^,]+)$/, " &\\1")
end
end
oninput={{ action (action 'valueChanged' additionalParam) value='target.value' }}
'.abc.dfu.'.replace(/(^\.|\.$)/g,'')
async function detectTaskAnProject({ getters, dispatch }) {
let projects = getters['project/projects'];
if (!projects.length) {
projects = await dispatch('project/fetch');
}
const tab = await getTabInfo();
const system = await detectSystem(projects, tab);
const project = await detectProject(projects, system.id);
let task = {};
bundle config --global build.mysql2 --with-opt-dir="$(brew --prefix openssl)"