Skip to content

Instantly share code, notes, and snippets.

View Yeboster's full-sized avatar
🧜
Surfing life's waves

Marco Yeboster

🧜
Surfing life's waves
View GitHub Profile
@marianoviola
marianoviola / README.md
Last active October 10, 2018 10:52
Vim digest

Editing with Vim

Modes

i Insert mode at cursor 
I Insert at beginning of line 
a Append at cursor 
A Append at the end of line
v visual mode

escape Exit insert mode

@jackii
jackii / gist:3722043
Created September 14, 2012 13:53 — forked from mark-ellul/gist:3531320
Email Boilerplate as HAML with yield to use as layout in Rails actionmailer
!!! Strict
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}/
%title Your Message Subject or Title
:css
/* Based on The MailChimp Reset INLINE: Yes. */
/* Client-specific Styles */
#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
@podhmo
podhmo / sqlalchemy_example.py
Created December 20, 2012 14:59
sqlalchemy query example.
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import scoped_session, sessionmaker
DBSession = scoped_session(sessionmaker())
class BaseMixin(object):
query = DBSession.query_property()
id = sa.Column(sa.Integer, primary_key=True)
@prwhite
prwhite / Makefile
Last active August 13, 2024 14:30
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@lfender6445
lfender6445 / gist:9919357
Last active August 5, 2024 17:39
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@olgakogan
olgakogan / sql_alchemy_samples.py
Last active February 7, 2023 22:49
SQL Alchemy Samples
########## CASE IN UPDATE STATEMENT ############
from sqlalchemy import case
# single value modification (the 'else' is not mandatory)
session.query(User).update({User.status : case([(User.status == "pending", "approved")], else_=User.status)}, False)
# multiple values modification
session.query(User).update({User.status : case([(User.status == "pending", "approved"),
(User.status == "waiting", "deprecated_status")])}, False)
@rxw1
rxw1 / .vimrc
Created March 27, 2015 00:41
My slow vim config
" http://www.github.com/rwilhelm/dotfiles/vimrc
" Tue Jun 17 01:33:55 CEST 2014
" 2007-2014 (c) rene.wilhelm@gmail.com
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
@toastal
toastal / Main.elm
Created December 6, 2016 22:46
Elm URL Parsing Playaround
module Main exposing (..)
{-| elm-package install elm-lang/navigation evancz/url-parser
-}
import Html exposing (Html, caption, div, table, tbody, td, text, th, thead, tr)
import Navigation exposing (Location)
import String
import UrlParser exposing (Parser, (</>), map, oneOf, s, int, string, top, parseHash)
@manasthakur
manasthakur / plugins.md
Last active June 2, 2024 07:29
Managing plugins in Vim

Managing plugins in Vim: The basics

Let's say the plugin is at a GitHub URL https://github.com/manasthakur/foo. First get the plugin by either cloning it (git clone https://github.com/manasthakur.foo.git) or simply downloading it as a zip (from its GitHub page).

Adding a plugin in Vim is equivalent to adding the plugin's code properly into its runtimepath (includes the $HOME/.vim directory by default). For example, if the layout of a plugin foo is as follows:

foo/autoload/foo.vim
foo/plugin/foo.vim
@manasthakur
manasthakur / submodules.md
Last active July 24, 2024 01:20
Using git submodules to version-control Vim plugins

Using git-submodules to version-control Vim plugins

If you work across many computers (and even otherwise!), it's a good idea to keep a copy of your setup on the cloud, preferably in a git repository, and clone it on another machine when you need. Thus, you should keep the .vim directory along with your .vimrc version-controlled.

But when you have plugins installed inside .vim/bundle (if you use pathogen), or inside .vim/pack (if you use Vim 8's packages), keeping a copy where you want to be able to update the plugins (individual git repositories), as well as your vim-configuration as a whole, requires you to use git submodules.

Creating the repository

Initialize a git repository inside your .vim directory, add everything (including the vimrc), commit and push to a GitHub/BitBucket/GitLab repository:

cd ~/.vim