Skip to content

Instantly share code, notes, and snippets.

View mehanig's full-sized avatar
💫

Mike Afanasev mehanig

💫
View GitHub Profile
@mehanig
mehanig / ctrr.md
Created November 16, 2017 21:12 — forked from esmooov/ctrr.md
Carats and Tildes, Resets and Reverts

Until last night I lived in fear of tildes, carats, resets and reverts in Git. I cargo culted, I destroyed, I laid waste the tidy indicies, branches and trees Git so diligently tried to maintain. Then Zach Holman gave a talk at Paperless Post. It was about Git secrets. He didn't directly cover these topics but he gave an example that made me realize it was time to learn.

A better undo

Generally, when I push out bad code, I panic, hit git reset --hard HEAD^, push and clean up the pieces later. I don't even really know what most of that means. Notational Velocity seems to be fond of it ... in that I just keep copying it from Notational Velocity and pasting it. Turns out, this is dumb. I've irreversibly lost the faulty changes I made. I'll probably even make the same mistakes again. It's like torching your house to get rid of some mice.

Enter Holman. He suggests a better default undo. git reset --soft HEAD^. Says it stag

import Ember from 'ember';
export default Ember.Component.extend({
data_sorted: Ember.computed.filter('data', function (object) {
return True;
});
actions: {
addRecord: function() {
this.send('addRecord');
@mehanig
mehanig / python3.rb
Created July 24, 2016 10:03
HomeBrew formula for python 3.4.3 on El Capitan
class Python3 < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
url "https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tar.xz"
sha256 "b5b3963533768d5fc325a4d7a6bd6f666726002d696f1d399ec06b043ea996b8"
revision 2
bottle do
revision 2
sha256 "41179565238d894d6b36e7b43eae2f00e6d774b8bebad2f8bf7e04519f8ab2c7" => :el_capitan
### Keybase proof
I hereby claim:
* I am mehanig on github.
* I am mehanig (https://keybase.io/mehanig) on keybase.
* I have a public key whose fingerprint is C74D 70E0 2F47 2D8F 87D9 0A32 30F8 8245 4CB0 7349
To claim this, I am signing this object:
@mehanig
mehanig / .vimrc
Last active August 29, 2015 14:27
.vimrc
" .vimrc File
" make sure vim history works
set viminfo+=!
" open and maximize the split below
map <C-J> <C-W>j<C-W>_
" open and maximize the split above
map <C-K> <C-W>k<C-W>_
" reduces splits to a single line
(python3) ➜ scrapi git:(python3) ✗ inv test
Raven is not configured (logging is disabled). Please see the documentation for more information.
INFO:raven.base.Client:Raven is not configured (logging is disabled). Please see the documentation for more information.
WARNING:scrapi.events:USE_FLUENTD is set to False; logs will not be stored
INFO:scrapi.base:Class BaseHarvester not added to registry
INFO:scrapi.base:Class JSONHarvester not added to registry
INFO:scrapi.base:Class XMLHarvester not added to registry
INFO:scrapi.base:Class OAIHarvester not added to registry
ERROR:scrapi.harvesters.plos:No PLOS_API_KEY found, PLoS will always return []
============================= test session starts ==============================
$(document).ready(function(){
var $t = $(this);
alert($t.find(".delete-url").data("urllink"));
var STRING = $t.find(".delete-url").data("urllink");
$("#sortable").sortable({
stop : function(event, ui) {
$.ajax({
beforeSend: function(xhr) {
var cookie = null;
var cookVal = null;
set name=D:\VIDEO\CPP_Course\Week3\Professor\Step4
set TIMESTAMP=%TIME:~0,2%_%TIME:~3,2%_%TIME:~6,2%
if exist %name%.TS (
START D:\VIDEO\MXLight\MXLight.exe record-to-file=%name%_%TIMESTAMP%.TS record=on
) else (
START D:\VIDEO\MXLight\MXLight.exe record-to-file=%name%.TS record=on
)
set name=D:\VIDEO\CPP_Course\Week3\ScreenCast\Final_ScreenCast_LAST
set EXT=mp4
set TIMESTAMP=%TIME:~0,2%_%TIME:~3,2%_%TIME:~6,2%
if exist %name%.%EXT% (
START D:\VIDEO\ffmpeg\bin\ffmpeg.exe -y -video_size 1920x1080 -pixel_format uyvy422 -rtbufsize 702000k -framerate 24 -f dshow -i video="Decklink Video Capture" %name%_%TIMESTAMP%.%EXT%
) else (
START D:\VIDEO\ffmpeg\bin\ffmpeg.exe -y -video_size 1920x1080 -pixel_format uyvy422 -rtbufsize 702000k -framerate 24 -f dshow -i video="Decklink Video Capture" %name%.%EXT%
)
struct Point{
int x;
int y;
};
bool operator< (const Point &cC1,const Point &cC2) {
return cC1.x < cC2.x;
}
class Rect {