Skip to content

Instantly share code, notes, and snippets.

@bultas
bultas / linux-setup.sh
Created April 26, 2024 21:08 — forked from dhh/linux-setup.sh
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils

Sentence Transformer Benchmark

Mix.install([
  {:bumblebee, github: "elixir-nx/bumblebee", ref: "23de64b1b88ed3aad266025c207f255312b80ba6"},
  {:nx, github: "elixir-nx/nx", sparse: "nx", override: true},
  {:exla, github: "elixir-nx/nx", sparse: "exla", override: true},
  {:axon, "~> 0.5.1"},
@bultas
bultas / frontmatter.ex
Created February 26, 2023 13:24 — forked from dsignr/frontmatter.ex
Parse frontmatter in Elixir
def extract(changeset) do
file_name = changeset.data.name
data = File.read!("#{@data_folder}/pages/#{file_name}")
case String.split(data, ~r/\n-{3,}\n/, parts: 2) do
[""] ->
%{frontmatter: nil, content: nil}
[frontmatter, content] ->
%{
frontmatter: parse_yaml(frontmatter),
content: content
@bultas
bultas / heroku-remote.md
Created July 1, 2020 13:03 — forked from randallreedjr/heroku-remote.md
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@bultas
bultas / listAllEventListeners.js
Created December 14, 2018 22:12 — forked from dmnsgn/listAllEventListeners.js
List all event listeners in a document
const listeners = (function listAllEventListeners() {
let elements = [];
const allElements = document.querySelectorAll('*');
const types = [];
for (let ev in window) {
if (/^on/.test(ev)) types[types.length] = ev;
}
for (let i = 0; i < allElements.length; i++) {
const currentElement = allElements[i];
@bultas
bultas / .gvimrc
Created November 21, 2018 16:47 — forked from ryanflorence/.gvimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Font
:set guifont=Source\ Code\ Pro:h14
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Hide pointless junk at the bottom, doesn't work in .vimrc for some reason?
:set laststatus=0
:set noshowmode "don't show --INSERT--
:set noruler "don't show line numbers/column/% junk
class Optimized extends React.PureComponent {
render() {
return this.props.children
}
}
const SomeConsumer = ({ slice, children } => (
<ActualConsumer>
{(state) => (
<Optimized slice={state[slice]}>
@bultas
bultas / children-as-function.js
Created November 20, 2017 15:44 — forked from iammerrick/children-as-function.js
Which API do you prefer? Passing a function into the Ratio component or making a higher order component called Ratio you can use to configure a component.
<Ratio width={Ratio.OPTIONS.FLUID} x={3} y={4}>
{(width, height) => (
<Chart id={this.props.id} width={width} height={height} />
)}
</Ratio>
@bultas
bultas / gist:6f4fccc1bb7d21cab9be4eec7c8cb843
Created August 25, 2016 16:47 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@bultas
bultas / 01_readme.md
Last active August 29, 2015 14:25 — forked from vslinko/01_readme.md
Experimental Relay Implementation

Experimental Relay Implementation

Features:

  • Relay.fetch(graphqlQuery) returns subscribtion that could change over time by mutation queries.
  • Relay.update(m: UpdateMutation) optimistically updates resource in all previous queries that contains updated resource.
  • Relay.update(m: DeleteMutation) optimistically deletes resource from all previous queries that contains deleted resource.
  • Relay.update(m: CreateMutation) pessimistically creates resource and executes again all previous queries.
  • All objects with id key in graphql response explained as resources. Arrays, objects without id and scalars explained as static properties.