Skip to content

Instantly share code, notes, and snippets.

Andrey Tarantsov andreyvit

Block or report user

Report or block andreyvit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andreyvit
andreyvit / Rakefile
Created Jun 27, 2012
Rakefile for setting up new Macs (part of my private ~/env Git repository)
View Rakefile
desc "Install zsh config"
task :zshconfig do
sh 'chsh -s /bin/zsh'
sh 'rm -f ~/.zshrc ~/.zshenv'
sh 'ln -s ~/env/config/zshenv ~/.zshenv'
sh 'ln -s ~/env/config/zshrc ~/.zshrc'
end
desc "Install ssh config"
task :sshconfig do
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
@andreyvit
andreyvit / AmazonS3BucketPolicy.xml
Created Jun 5, 2012
S3 bucket policy to enable everyone to access a certain bucket's file
View AmazonS3BucketPolicy.xml
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@andreyvit
andreyvit / ObjCObject.mm
Created May 5, 2012
Fake an Objective-C class out of a C++ class
View ObjCObject.mm
// Fakes an Objective-C class out of a C++ class.
//
// Note that this is a very bad and completely superfluous idea, but after looking up a way
// to build Objective-C classes at run time, I just had to do this no matter what. (Besides,
// I really hated maintaining mutual pointers in UIElement/UIElementDelegate class pairs.)
//
// Building up a whole class from scratch (objc_allocateClassPair) looked like a lot of trouble,
// so I compile a real Objective-C class instead, but instead of instantiating it by regular means
// (alloc/init or class_createInstance), I simply cast a part of a C++ object to (id).
// I've looked at the source code for class_createInstance and this hack should work perfectly,
@andreyvit
andreyvit / old-mainwindow.coffee
Created Apr 27, 2012
Old RPC-based approach for building the UI (IcedCoffeeScript)
View old-mainwindow.coffee
module.exports = class MainWindowUI
show: (callback) ->
@window = new UIWindow 'MainWindow',
addProjectButton: new UIButton
click: =>
LR.log.fyi "Clicked Add Project button"
removeProjectButton: new UIButton
click: =>
LR.log.fyi "Clicked Remove Project button"
View 0_NodeAppUI.md

NodeApp UI Architecture

Native side handles the view layer of MVC, while the Node.js backend handles the controller (and model) layers.

Goals:

  • Pleasant and artful code on the backend side
  • No boilerplate code on the native side
  • Keeping the native side to a reasonable minimum (stuff like 'stringByAppendingString' or 'WS_EX_ACCEPTFILES' should still reside in the native land!)
@andreyvit
andreyvit / gist:2466992
Last active Oct 3, 2015
The Open Community Indie Software License
@andreyvit
andreyvit / Rakefile
Created Apr 16, 2012
Rake tasks to initialize a new Mac
View Rakefile
desc "Install zsh config"
task :zshconfig do
sh 'chsh -s /bin/zsh'
sh 'rm -f ~/.zshrc ~/.zshenv'
sh 'ln -s ~/env/config/zshenv ~/.zshenv'
sh 'ln -s ~/env/config/zshrc ~/.zshrc'
end
desc "Install ssh config"
task :sshconfig do
@andreyvit
andreyvit / tender-proxy.php
Created Apr 14, 2012
Tender (tenderapp.com) proxy script
View tender-proxy.php
<?php
// Works: browsing, logging in, file downloads, images attached to KB articles
// Doesn't work: posting, file uploads
error_reporting(E_ERROR);
// phpinfo(); exit;
define('OUR_HOST', 'livereload.com');
define('THEIR_HOST', 'livereload.tenderapp.com');
@andreyvit
andreyvit / DockIcon.h
Created Mar 25, 2012
Show in Dock / Menu Bar / Nowhere coordinator
View DockIcon.h
#import <Foundation/Foundation.h>
typedef enum {
AppVisibilityModeNone,
AppVisibilityModeDock,
AppVisibilityModeMenuBar
} AppVisibilityMode;
You can’t perform that action at this time.