Skip to content

Instantly share code, notes, and snippets.

@daveknapik
daveknapik / docker-cp
Last active September 25, 2020 03:30
docker copy from container to host
docker cp 4fdc727bd364:/web/tmp/discount_purge.csv /Users/david.knapik/Documents/pj-discount-purge
@daveknapik
daveknapik / fzf-oh-my-zsh-git.md
Last active March 7, 2022 02:27
Making fzf and oh-my-zsh and git happy
<script type="text/javascript">
function MixPanelMock() {
this.track = track;
this.alias = alias;
this.identify = identify;
this.people = new People();
function track(eventString) {
console.log(eventString);
}
### Keybase proof
I hereby claim:
* I am daveknapik on github.
* I am daveknapik (https://keybase.io/daveknapik) on keybase.
* I have a public key whose fingerprint is E310 FF92 B3FE BB5A F56D ABC2 ED29 A536 6EFE 988D
To claim this, I am signing this object:
$.mockjax({
url: '/foo',
responseTime: 100,
responseText: {
status: 'success',
message: 'well done, you!'
}
});
$.ajax({
@daveknapik
daveknapik / PS1
Last active August 29, 2015 13:56
From my .bashrc, this sets up a PS1 with colors I dig that indicates if the branch is dirty
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
@daveknapik
daveknapik / after_use_show_ruby
Last active January 4, 2016 03:29
~/.rvm/hooks/after_use_show_ruby
if [ ! -z "$rvm_gemset_name" ]
then
echo "Now using $rvm_ruby_string with gemset $rvm_gemset_name"
elif [ ! -z "$rvm_ruby_string" ]
then
echo "Now using $rvm_ruby_string"
fi
@daveknapik
daveknapik / format_stylesheets_for_asset_pipeline.rb
Created September 12, 2013 18:09
Rake task to format url() calls in stylesheets to the Rails 3.1+ image-url sass helper as well as clean up the url in the process
desc "Replaces and reformats url() calls in .scss files with image-url()"
task :format_stylesheets_for_asset_pipeline do
regex = /(url)\(('?|"?)(\/images\/)([^"']*)('?|"?)\)/
Dir.glob("app/assets/stylesheets/**/*.scss") do |filename|
unless File.directory?(filename)
output = ""
lines = []
file = File.open(filename, "r")
@daveknapik
daveknapik / rails-ujs-callbacks-example.js.coffee
Created November 21, 2012 16:04
Rails 3.1 UJS callback example implementation in CoffeeScript
$ ->
$("#search-form").on
"ajax:beforeSend": (e, xhr, settings) ->
console.log e
console.log xhr
console.log settings
"ajax:success": (e, data, status, xhr) ->
console.log e
console.log data
console.log status