Skip to content

Instantly share code, notes, and snippets.

@asok
asok / keybase.md
Created August 10, 2021 11:58
Claim on github account

Keybase proof

I hereby claim:

  • I am asok on github.
  • I am asok (https://keybase.io/asok) on keybase.
  • I have a public key ASAKM9V7cOg7F-Qgf9ipnguXsQ5ZyVYOS09a6cvmQAFJVAo

To claim this, I am signing this object:

@asok
asok / type_cast.rb
Created July 13, 2016 10:56
Re-use of ActiveRecord's coercion
Documas::Study.connection.type_map.fetch("boolean").type_cast_from_user("0")
if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='%n %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} '
RPS1='$(vi_mode_prompt_info 2>/dev/null) ${return_code}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
var create = function(entries) {
$.each($.grep(entries, function(_entry){ return _entry.fields.company }),
function(key, entry) {
var li = $(document.createElement('li'));
li.append($('<h3>' + entry.fields.company + '</h3>'));
li.append($('<span>' + entry.fields.years + '</span>'));
li.append($('<h4>' + entry.fields.position + '</h4>'));
li.append($('<p>' + entry.fields.jobDescription + '</p>'));
@asok
asok / have_enqueued_job.rb
Last active January 4, 2016 20:20
Modified "have_enqueued_job" matcher to handle case when `Sidekiq::Testing` is disabled.
module RSpec
module Sidekiq
module Matchers
def have_enqueued_job *expected_arguments
HaveEnqueuedJob.new expected_arguments
end
class HaveEnqueuedJob
def initialize expected_arguments
@expected_arguments = expected_arguments
diff --git a/rspec-mode.el b/rspec-mode.el
index 29c0d28..e7c5431 100644
--- a/rspec-mode.el
+++ b/rspec-mode.el
@@ -153,6 +153,11 @@
:type 'string
:group 'rspec-mode)
+(defcustom rspec-compilation-in-comint-mode nil
+ "t when compilation buffer should be in Comint mode with `compilation-shell-minor-mode'"
@asok
asok / gist:4352818
Last active December 10, 2015 00:39
Scenario: html-erb-mode not working
Given I have master of mmm-mode in "~/mmm-mode" directory
And I have file "test.el" with content:
'''
(add-to-list 'load-path "~/mmm-mode/")
(require 'mmm-auto)
(require 'mmm-erb)
(setq mmm-global-mode 'auto)
@asok
asok / gist:4352610
Last active December 10, 2015 00:39
Scenario: html-erb-mode not working
Given I have master of mmm-mode in "~/mmm-mode" directory
And I have file "test.el" with content:
'''
(add-to-list 'load-path "~/mmm-mode/")
(require 'mmm-auto)
(require 'mmm-erb)
(setq mmm-global-mode 'auto)
(defmacro sformat/macro (template values)
`(sformat
,template
(lambda (key) (plist-get ,values (intern key)))))
(sformat/macro
"help ${name}! I'm ${malady}"
'(name "nic" malady "on fire"))
require 'net/pop'
class Droms::ReplyMailerJob
def perform
logger = RAILS_DEFAULT_LOGGER
if (Droms::Configuration[:email_settings][:use_ssl])
Net::POP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE)
port = 995
else