Skip to content

Instantly share code, notes, and snippets.

View Syntaf's full-sized avatar
🚄
Rails Enthusiast

Grant Mercer Syntaf

🚄
Rails Enthusiast
View GitHub Profile
@walkness
walkness / query.py
Last active June 28, 2022 12:25
Django regex replace for PostgreSQL
from django.db.models import Func, F, Value
from images.models import Image
Image.objects.all().update(original_filename=Func(F('file'), Value('^.*\/(.*)$'), Value('\\1'), function='regexp_replace'))
anonymous
anonymous / playground.rs
Created August 23, 2015 23:18
Shared via Rust Playground
fn main() {
let g = vec![1, 5, 6, 9, 8];
let r = 7;
let mut i = g.iter().enumerate().peekable();
while let Some((index, lhs_val)) = i.next() {
let lookahead = i.peek();
println!("{}, {} with lookahead {:?}", index, lhs_val, lookahead);
}

Git Cheat Sheet

Commands

Getting Started

git init

or

@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 19, 2024 17:40
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@pyk
pyk / active-record-migration-expert.md
Last active August 2, 2021 09:20
become active record migration expert (Rails 4.0.2)

become active record migration expert (Rails 4.0.2)

workflow:

create model

$ rails g model NameOfModel
    invoke  active_record
    create    db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb
@scturtle
scturtle / app.py
Created April 14, 2013 04:53
Flask login with google+ oauth
from flask import Flask, request, session, redirect, url_for
import urllib
import requests
app = Flask(__name__)
app.secret_key = 'iwonttellyou'
redirect_uri = 'http://localhost:5000/callback'
client_id = '' # get from https://code.google.com/apis/console
client_secret = ''

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close