Skip to content

Instantly share code, notes, and snippets.

View srghma's full-sized avatar

Serhii Khoma srghma.github.io/how-life-was-created srghma

View GitHub Profile
@emk
emk / 1_front.html
Created August 22, 2012 15:16
Anki 2 cards with hidden transliterations on the front
<div class="signes">{{Signes H}}</div>
<input type="button" value="Translittération" onclick="document.getElementById('transliteration').className += ' shown'; this.style.display = 'none'; return false;">
<div id="transliteration" class="transliteration">{{Translittération}}</div>
@stevenharman
stevenharman / _angularjs_and_rails_asset_pipeline.md
Last active April 30, 2016 23:20
Load the Angular.js $templateCache while building assets for Rails Asset Pipeline. Be sure in require the `templates` module as a dependency of your Angular.js app.

AngularJS + Rails Asset Pipeline

This is my hand-rolled solution for getting Angular assets (Controllers, Models, Directives, Templates, etc.) integrated into the Rails Asset Pipeline.

Templates and the $templateCache

Of particular note: this hack will also load the AngularJS $templateCache with your templates, while allowing you to use Slim, ERB, etc. to write your templates.

static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* Keymap: The Laye r in QWERTY
*
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | = | 1 | 2 | 3 | 4 | 5 | ESC | | - | 6 | 7 | 8 | 9 | 0 | - |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | FN1 | | FN2 | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
@hdeshev
hdeshev / .ctags-css
Last active May 4, 2017 17:01
ctags extras
--langdef=css
--langmap=css:.css
--langmap=css:+.scss
--langmap=css:+.sass
--langmap=css:+.styl
--langmap=css:+.less
--regex-css=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
--regex-css=/^[ \t]*#([A-Za-z0-9_-]+)/#\1/i,id,ids/
--regex-css=/^[ \t]*\.([A-Za-z0-9_-]+)/\1/c,class,classes/
@adamwespiser
adamwespiser / free-mtl-notes
Last active February 4, 2018 21:54
A comparison of performance between Free Monad and mtl transformers
Objective: A comparison of performance between Free Monad and mtl transformers
```Haskell
Free f a = { unFree :: f (Free f a) }
```
http://softwareengineering.stackexchange.com/questions/242795/what-is-the-free-monad-interpreter-pattern
# construction of free monad via individual functions
http://www.atamo.com/articles/free-monads-wont-detox-your-colon/
@blakerego
blakerego / gist:5388897
Created April 15, 2013 15:23
haml-simple-form-datetime-bootstrap
= simple_form_for([:admin, @announcement]) do |f|
= f.error_notification
- current_profile = Profile.find_by_user_id(@current_user.id)
.form-inputs
= f.input :message, :required => true
= f.hidden_field :profile_id, :value => @current_user.primary_profile.id
= f.fields_for :TvScreen do |tv|
/// STARTS
= tv.input :starts_on, :placeholder => "MM/DD/YYYY", :input_html => {:class => "datepicker date-picker"}, :label => "Announcement starts on"
#!/usr/bin/env bash
if [ $# -eq 0 ]; then
printf 1 "Usage: $(basename $0) [build-args [-- run-args [-- cmd-args] ] ]"
printf 1 " NOTE!!! the -rm-flag is hardcoded for build!"
fi
BUILD_ARG=()
RUN_ARG=()
CMD_ARG=()
@karloku
karloku / README.md
Last active March 30, 2018 07:28
Rails Template using GraphQL

This template is supposed to be applied to rails 5.

run with:

rails new <application_name> --template=https://gist.githubusercontent.com/karloku/edd6a158e275fdefa334/raw/b56175bee5b45d32310aeb620e23be44e3c2a56d/graphql_template.rb -T

using gems:

  • graphql
  • graphql-mutable_type
@joefiorini
joefiorini / rails.nix
Created September 18, 2014 06:16
Nix Expression for Running Rails Apps
with (import <nixpkgs> {});
stdenv.mkDerivation {
name = "717-app";
buildInputs = [ libiconv openssl ruby21 postgresql git nodejs ];
src = "/src/717";
builder = builtins.toFile "builder.sh" ''
set -e
source $stdenv/setup
@nukturnal
nukturnal / audio_length.rb
Created January 18, 2010 22:54
Extracting audio length with Rails and ffmpeg
def self.get_audio_length(filepath)
pipe = "ffmpeg -i "+ filepath.to_s+" 2>&1 | grep 'Duration' | cut -d ' ' -f 4 | sed s/,//"
command = `#{pipe}`
if command =~ /([\d][\d]):([\d][\d]):([\d][\d]).([\d]+)/
#convert the result to only secs
duration = ($2.to_i * 60) + $3.to_i
end
#return and array containing the seconds and the human readable time length, ["6453","03:54"]
return "#{duration.to_s},#{$2}:#{$3}".split(",")
end