Skip to content

Instantly share code, notes, and snippets.

Mo Omer momer

Block or report user

Report or block momer

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
View issue.scala
object MyObject {
def processFile(file: File) = {
def using[R <: Closeable, T](s: R)(f: R => T): T = {
try {
f(s)
} finally {
s.close()
}
}
View wgetSite.sh
!#/bin/bash
wget \
--limit-rate=200k \
--no-clobber \
--convert-links \
--adjust-extension \
--random-wait \
--recursive \
--execute \
@momer
momer / chrome.ts
Created Dec 6, 2017 — forked from rkistner/chrome.ts
Using Chrome on Lambda
View chrome.ts
import { spawn, execSync, ChildProcess } from 'child_process'
import * as net from 'net'
const { chromePath } = require('aws-lambda-chrome');
const Cdp = require('chrome-remote-interface');
export type ChromeHandler<T> = (client: ChromeClient) => Promise<T>;
// These security features are not supported at all, and need to be disabled.
View patch
diff -Nur "/media/parallels/Parallels Tools/installer/install-kmods.sh" ./installer/install-kmods.sh
--- "/media/parallels/Parallels Tools/installer/install-kmods.sh" 2015-09-21 12:27:40.000000000 +0400
+++ ./installer/install-kmods.sh 2016-04-12 18:04:02.213928961 +0400
@@ -218,6 +218,9 @@
if [ $make_flag -eq 0 ]; then
# Unpack kernel module sources
tar -xzf "$KMOD_DIR/$PRL_MOD.$TGZEXT" -C "$KMOD_DIR"
+ pushd "$KMOD_DIR"
+ patch -p1 < $KMOD_DIR/parallels-1.patch
+ popd
View tmux.conf
unbind C-b
set -g prefix C-s
bind C-s send-prefix
setw -g mode-keys vi
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
set -g default-terminal "screen-256color"
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
View Vimmint
execute pathogen#infect()
syntax enable
set hidden
set background=dark
"colorscheme monokai
:let g:airline_theme='molokai'
filetype plugin indent on
set nu
highlight SyntasticErrorLine guibg=#2f0000
View question.rb
# Questions should be re-usable across different reports / question sets.
#
# Let's separate their concerns, then.
class Question < ActiveRecord::Base
belongs_to :question_element, polymorphic: true, touch: true
has_many :report_questions
has_many :reports, through: :report_questions
validates :question_element_type, presence: true
@momer
momer / addDefaultTimestamp.sh
Last active Aug 29, 2015
One liner to rename a directory of migration files to appease the automation gods; and another to add a default timestamp to created/updated at fields
View addDefaultTimestamp.sh
for file in ./*.sql; do gsed -i.bak -e 's@\(created_at\|updated_at\)\(\s*\)\(timestamp without time zone\)\([,]\?\)@\1\2\3 DEFAULT statement_timestamp()\4@g' $file; done;
View ImplementsDynamic.hx
package myApp;
class ImplementsDynamic
implements Dynamic<String> {
public var present:Int;
public function new() {}
}
@momer
momer / sql_resources.md
Last active Nov 5, 2019
SQL learning Resources for Beginners
View sql_resources.md

There are a number of good introductory SQL resources available for free and online. There are also some paid resources which I recommend for beginners, that are very effective, and well worth expensing in my opinion.

A couple of notes:

  • I haven’t used all of these resources, but they come with strong recommendations around the web or myself/my peers.
  • You absolutely don’t need to use every single resource. Find a couple that work for you, and go to town.
  • You can always reach out to me if you have questions. I always paste this online when people are new to asking very technical questions – it’s not meant to be snarky – it's a gentle guide on how to compose your questions and gather necessary resources in order to best give technical people the information needed to get a quick/effective response: http://www.mikeash.com/getting_answers.html

Video/Class/Mini-course based:

  1. Stanford Self-paced ‘Database’ course
  • The original Coursera
You can’t perform that action at this time.