Skip to content

Instantly share code, notes, and snippets.

@syntruth
syntruth / syntruth.omp.toml
Created June 19, 2024 21:44
Syntruth Oh My Posh Theme
#:schema https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
version = 2
console_title_template = '{{ .Folder }}'
[palette]
blue = "#2c699a"
green = "#16db93"
lightblue = "#048ba8"
1091a1092,1093
> // This will be memoized after the first call and will default
> // to 'id'.
1093c1095,1131
< return attrs[this.model.prototype.idAttribute || 'id'];
---
> if (this._modelId) return attrs[this._modelId];
>
> this._modelId = this._findIdAttribute(attrs)
>
@syntruth
syntruth / .tmux-prompt.sh
Created January 7, 2015 19:33
tmux prompt shell script
get_title () {
host=`hostname -s`
# This is from the .git-prompt.sh file.
git=`__git_ps1 " [%s]"`
printf "${host}${git}"
}
set_title () {
@syntruth
syntruth / .tmux.conf
Created January 7, 2015 19:28
My tmux config
# Change default prefix
unbind C-b
set -g prefix C-a
# set correct term
set -g default-terminal screen-256color
# start window indexing at one instead of zero
set -g base-index 1
class App.Views.SortCaret extends Backbone.View
tagName: 'span'
className: 'sort-caret-container'
downCaret: 'fa-caret-down'
upCaret: 'fa-caret-up'
constructor: (options = {}) ->
@downCaret = options.downCaret if options.downCaret
@upCaret = options.upCaret if options.upCaret
class ValidationErrors
constructor: () ->
this.reset()
return
reset: () ->
@errors = {}
return this
class Module
@moduleKeywords = ['instance', 'extended', 'included']
@extend: (obj, mixin) ->
for key, value of mixin when key not in @moduleKeywords
obj[key] = value
if typeof mixin.instance is 'object'
@include obj, mixin.instance
@syntruth
syntruth / path-tree-map-reduce.rb
Last active August 29, 2015 14:07
MongoDB Tree MapReduce
# Encoding: UTF-8
# This defined a way to do a Map/Reduce search
# in MongoDB to find all service groups that has
# a given device in either the TX or RX path tree.
module ServiceGroupPathSearch
extend ActiveSupport::Concern
included do
class_eval do
@syntruth
syntruth / example.md
Last active August 29, 2015 14:04
Backbone.Stickit Example

MOP view template in HAML

%script#mop-template{type: 'text/html'}
  .container-fluid
    .section
      .row
        .col-md-12.section-name
          %label Reason
      .row
        .col-md-12.section-edit
class RackPathInfoFix
def initialize(app)
@app = app
end
def call(env)
env['PATH_INFO'] = File.join(env['SCRIPT_NAME'], env['PATH_INFO'])
@app.call env
end