Skip to content

Instantly share code, notes, and snippets.

View thesowah's full-sized avatar

Adjetey Sowah thesowah

  • Accra, Ghana
  • 15:07 (UTC)
View GitHub Profile
@thesowah
thesowah / brace-effect
Created March 19, 2014 00:04
CSS tweak for open braces effect on HTML links
/*****************************************************************************/
/* Links
/*****************************************************************************/
a {
color: black !important;
text-decoration: none !important;
cursor: pointer;
}
.post a {
border-bottom: 1px dotted #b3b3b1;
@thesowah
thesowah / utility.rb
Created June 23, 2014 01:44
Utility script for Afridevcmty
# 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 = "https://api.github.com/search/users"
@thesowah
thesowah / feed.xml
Created June 24, 2014 13:40
Jekyll Template for Atom, RSS feed. Template leaves HTML entities like — intact in XML + XSLT
---
layout: nil
title : Atom Feed
---
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [<!ENTITY mdash "&#x2014;">]>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="text" xml:lang="en">{{site.name}}</title>
<link type="application/atom+xml" href="{{site.url}}/feed.xml" rel="self"/>
<link type="text/html" href="{{site.url}}" rel="alternate"/>

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
thesowah / Regex for Notepad++
Last active August 29, 2015 14:05
Fixes error in parsing XML to excel worksheet [ASP.NET C#]
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>
require 'restclient'
require 'json'
require 'digest'
class IGDownloader
def initialize(output_path)
@base_output_path = output_path
end
@thesowah
thesowah / index.md
Last active August 29, 2015 14:13 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

<?php
//...
class Person
{
/* @var \Doctrine\Common\Collections\Collection */
private $talents
/* @var string */
private $gender
@thesowah
thesowah / relationship.orm.yml
Created December 10, 2013 14:20
One-to-one && One-to-many Object relationships (YAML configuration to auto-entity generation in Symfony2)
# one-to-one, bidirectional
Customer:
oneToOne:
cart:
targetEntity: Cart
mappedBy: customer
Cart:
oneToOne:
customer:
targetEntity: Customer
@thesowah
thesowah / plh.rb
Last active July 30, 2021 18:02
Parse link headers from Github API in Ruby
require 'rest_client'
class Plh
def self.parse_link_header(url, params={})
response = RestClient.get url, params
links = Hash.new
parts = response.headers[:link].split(',')
# Parse each part into a named link
parts.each do |part, index|