Skip to content

Instantly share code, notes, and snippets.

@vitalybe
vitalybe / gist:db36feb702d686cb53b7
Created May 8, 2014 07:54
Controller structure
app.controller('DemoController', function ($scope, MyService) {
var _count = 0;
function _privateUtil() { // function decomposition
_count += _count + 1;
}
function _handleClick(data) {
_privateUtil();
$scope.answer = MyService.doSomething({
@vitalybe
vitalybe / gist:b8b3714e0b2f3b099ac1
Created May 8, 2014 08:10
Suggested controller/service structure
{
// private field init
var a = 1;
// public field init
$scope.b = 1; // For controllers
this.c = 1; // For services
// call init function
init();
{
// private field init
var a = 1;
// Initialization logic is here
if () {
...
}
// Private functions
@vitalybe
vitalybe / index.html
Created November 24, 2014 20:50
Vitaly final // source http://jsbin.com/moqocu/15
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Vitaly final" />
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
div {
height: 100px;
width: 100px;
safereset = "!f() { \
trap 'echo ERROR: Operation failed; return' ERR; \
echo Making sure there are no changes...; \
last_status=$(git status --porcelain);\
if [[ $last_status != \"\" ]]; then\
echo There are dirty files:;\
echo \"$last_status\";\
echo;\
echo -n \"Enter Y if you would like to DISCARD these changes or W to commit them as WIP: \";\
read dirty_operation;\
@vitalybe
vitalybe / gist:aad75b23da636e615248
Created February 24, 2015 11:24
PR-list example
ID | Last SHA | Owner | Branch | Title
---- | ---------- | --------------- | ------------------------------ | ----------------------------------------
197 | 9287bb6 | jkirkpatrick | qa | Protractor tests with multiple chrome profiles
150 | 8791ab9 | oliversalzburg | feature/strict-di | fix(strictdi): Use strict DI wherever possible
136 | d2ca167 | itsananderson | fix-strict-di | Annotate config and decorator to avoid strictDI errors
120 | bab8b92 | jayhogan | bindings | Show element binding expressions in the sidebar panel alongside
118 | 1642b4a | hupfis | master | Use outline instead of border to keep layout
111 | 4498e13 | blackxored | add-class-to-inspector | Add class to floating inspector
106 | 9537399 | rpl | prototype/firefox-devtools-port| WIP: port to Firefox
105 | 0e55aef | caitp
@vitalybe
vitalybe / .gitconfig
Created February 25, 2015 12:28
Awesome git aliases
safereset = "!f() { \
trap 'echo ERROR: Operation failed; return' ERR; \
echo Making sure there are no changes...; \
last_status=$(git status --porcelain);\
if [[ $last_status != \"\" ]]; then\
echo There are dirty files:;\
echo \"$last_status\";\
echo;\
echo -n \"Enter D if you would like to DISCARD these changes or W to commit them as WIP: \";\
read dirty_operation;\
@vitalybe
vitalybe / fav.bat
Last active April 17, 2022 00:18
Favorite folders batch (For Windows)
@setlocal
@echo off
set userChoice=%1
rem The format is:
rem call :condition SHORTCUT FOLDER
call :condition web c:\Git\SecThor\SecWeb\App\
call :condition cloud c:\Git\SecThor\SecCloud\dojo.backend\
call :condition good c:\Users\Vitaly\Dropbox\Projects\goodread-friends\
endlocal
popd
@vitalybe
vitalybe / tab.bash
Last active May 11, 2022 08:14 — forked from bobthecow/tab.bash
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
tell application "iTerm"
-- Create a new terminal window or tab.
set myterm to (make new terminal)
tell myterm
-- Create a new session.
set mysession to (make new session at the end of sessions)