Skip to content

Instantly share code, notes, and snippets.

View maysam's full-sized avatar
🏠
Working from home

Maysam Torabi maysam

🏠
Working from home
View GitHub Profile
@harry-wood
harry-wood / installing libxml on mac for ruby.md
Last active May 25, 2024 17:50
Installing libxml on mac for ruby.md

Installing/debugging libxml on mac for ruby/rails

Install xcode command line tools (or check if they're already installed)

xcode-select --install

Do we have libxml installed already?

xsltproc --version
@mikenikles
mikenikles / config.yml
Last active November 23, 2021 16:52
A (mostly) automated release process
version: 2
# Re-usable blocks to reduce boilerplate
# in job definitions.
references:
container_config: &container_config
docker:
- image: my-company/circleci:gcloud # We use a custom Alpine Linux base image with the bare minimum
working_directory: /tmp/workspace
restore_repo: &restore_repo
@wojteklu
wojteklu / clean_code.md
Last active June 29, 2024 08:22
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@wojteklu
wojteklu / terminal_notification.md
Last active April 28, 2023 00:43
Show macOS notification when long running command finishes and your terminal is not in focus.

Add the following to your ~/.zshrc:

function notifyme {
  LAST_EXIT_CODE=$?
  CMD=$(fc -ln -1)
  osascript -e 'on run argv
  tell application "System Events"
    set frontApp to name of first application process whose frontmost is true
 if frontApp is not "Terminal" then
@kosyfrances
kosyfrances / heroku_database_copy.md
Last active March 15, 2023 09:50
To copy heroku database from one app to another and from local to heroku

To copy database from one heroku app to another -

heroku pg:backups capture [database_name]
heroku pg:backups restore $(heroku pg:backups public-url --app source_app) DATABASE_URL --app target_app

You can refer to https://devcenter.heroku.com/articles/heroku-postgres-backups for more information.

To copy database from local to heroku - Dump your local database in compressed format using the open source pg_dump tool: PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump where myuser is your database username and mydb is the database name.

@robUx4
robUx4 / FragmentCursor.java
Last active January 6, 2016 17:05
Basic SwipeRefreshLayout support in ListFragment, you get support for an empty view in ListFragment. You need to set an OnRefreshListener and call setRefreshing()
import org.gawst.proxy.ui.SwipeListFragment;
import android.content.Context;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.support.v4.widget.CursorAdapter;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.View;
@jordangarcia
jordangarcia / jsbin.kubosudi.css
Created June 5, 2014 22:04
Example of drag and drop using Hammer.js
.box {
padding: 5px;
background: red;
margin: 10px;
position:relative;
z-index: 3;
}
.drag-target {
background: blue;
z-index: 1;
anonymous
anonymous / gist:4446501
Created January 3, 2013 19:51
This is a script to build a quick vocabulary of the most frequent words in a language, based on spidering and scraping a list of urls. It shows context and links to a google translate page.
#!/usr/bin/perl
$|=1;
use strict;
use warnings;
use LWP::UserAgent;
use URI::URL;
use HTML::Strip;
:+1:
:-1:
:airplane:
:art:
:bear:
:beer:
:bike:
:bomb:
:book:
:bulb:
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')