Skip to content

Instantly share code, notes, and snippets.

Ryan Billingsley ryanbillingsley

Block or report user

Report or block ryanbillingsley

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
@poteto
poteto / flatten_nested_json.ex
Last active Apr 20, 2018
Flatten deeply nested Map in Elixir
View flatten_nested_json.ex
defmodule Json do
def flatten(%{} = json) do
json
|> Map.to_list()
|> to_flat_map(%{})
end
def flatten(%{} = json) when json == %{}, do: %{}
defp to_flat_map([{_k, %{} = v} | t], acc), do: to_flat_map(Map.to_list(v), to_flat_map(t, acc))
defp to_flat_map([{k, v} | t], acc), do: to_flat_map(t, Map.put_new(acc, k, v))
@AndrewRussellHayes
AndrewRussellHayes / Boot2Docker_Rebuild.sh
Last active Aug 29, 2015
boot2docker vm rebuild. this gets rid of images that wont delet
View Boot2Docker_Rebuild.sh
b2d(){
boot2docker $1;
}
b2d poweroff
b2d delete
b2d init
b2d up
View Common Swift String Extensions
import Foundation
extension String
{
var length: Int {
get {
return countElements(self)
}
}
@brentsimmons
brentsimmons / gist:5810992
Last active May 31, 2020
Detect a tap on a URL inside a UITextView. Note: the rs_links method isn't included -- you'll need something that takes text and returns an array of detected links. This gist just demonstrates walking through the UITextView characters.
View gist:5810992
@implementation UITextView (RSExtras)
static BOOL stringCharacterIsAllowedAsPartOfLink(NSString *s) {
/*[s length] is assumed to be 0 or 1. s may be nil.
Totally not a strict check.*/
if (s == nil || [s length] < 1)
return NO;
@wrburgess
wrburgess / gist:5528649
Last active May 21, 2020
Backup Heroku Postgres database and restore to local database
View gist:5528649

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@joost
joost / ruby_google_analytics_server_to_server.md
Last active Jan 30, 2019
Google Analytics API (server-to-server) using Ruby
View ruby_google_analytics_server_to_server.md
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active Jun 3, 2020
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@clweathers
clweathers / UIView+DEFrameAdditions.h
Last active Dec 10, 2015
FRAMED: A UIView Category
View UIView+DEFrameAdditions.h
//
// UIView+DEFrameAdditions.h
//
// Copyright (c) 2011-2013 Double Encore, Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the distribution. Neither the name of the Double Encore Inc. nor the names of its
// contributors may be used to endorse or promote products derived from this software without specific prior written permission.
View states_hash.json
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@PrinceNebulon
PrinceNebulon / NoChromeButton.xaml
Created Jan 27, 2012
WPF "No Chrome Button" style
View NoChromeButton.xaml
<!-- Style -->
<Style x:Key="NoChromeButton" TargetType="{x:Type Button}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Padding" Value="1"/>
<Setter Property="Template">
<Setter.Value>
You can’t perform that action at this time.