Skip to content

Instantly share code, notes, and snippets.


Adjetey Sowah thesowah

View GitHub Profile

Rails Models

Generating models

$ rails g model User




View ig_downloader.rb
require 'restclient'
require 'json'
require 'digest'
class IGDownloader
def initialize(output_path)
@base_output_path = output_path
thesowah / Regex for Notepad++
Last active Aug 29, 2015
Fixes error in parsing XML to excel worksheet [ASP.NET C#]
View Regex for Notepad++
Using Notepad++ search and replac all the illegal characters in XML file
//#1 All cells with whitespace and chars like '&' but start with alphabets
Find: <Data ss:Type="String">([a-zA-Z]+(.+))</Data>
Replace: <Data ss:Type="String"><![CDATA[$1]]></Data>
//#2 All empty cells
Find: <Data ss:Type="String">*</Data>
Replace: <Data ss:Type="String"><![CDATA[-]]></Data>

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

thesowah / feed.xml
Created Jun 24, 2014
Jekyll Template for Atom, RSS feed. Template leaves HTML entities like &mdash; intact in XML + XSLT
View feed.xml
layout: nil
title : Atom Feed
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY mdash "&#x2014;">]>
<feed xmlns="">
<title type="text" xml:lang="en">{{}}</title>
<link type="application/atom+xml" href="{{site.url}}/feed.xml" rel="self"/>
<link type="text/html" href="{{site.url}}" rel="alternate"/>
thesowah / utility.rb
Created Jun 23, 2014
Utility script for Afridevcmty
View utility.rb
# This utility class is help gather data while avoiding
# Github's seach restriction of 1,000 results
# and traverse through the results using Link headers
# FYI: Our results is about 2700
require 'rest_client'
require 'json'
class Utility
@url = ""
thesowah / plh.rb
Last active Jul 30, 2021
Parse link headers from Github API in Ruby
View plh.rb
require 'rest_client'
class Plh
def self.parse_link_header(url, params={})
response = RestClient.get url, params
links =
parts = response.headers[:link].split(',')
# Parse each part into a named link
parts.each do |part, index|
thesowah / brace-effect
Created Mar 19, 2014
CSS tweak for open braces effect on HTML links
View brace-effect
/* Links
a {
color: black !important;
text-decoration: none !important;
cursor: pointer;
.post a {
border-bottom: 1px dotted #b3b3b1;
thesowah / relationship.orm.yml
Created Dec 10, 2013
One-to-one && One-to-many Object relationships (YAML configuration to auto-entity generation in Symfony2)
View relationship.orm.yml
# one-to-one, bidirectional
targetEntity: Cart
mappedBy: customer
targetEntity: Customer
View Person
class Person
/* @var \Doctrine\Common\Collections\Collection */
private $talents
/* @var string */
private $gender