Skip to content

Instantly share code, notes, and snippets.

View cyle's full-sized avatar

cyle gage cyle

View GitHub Profile
@cyle
cyle / npf_tumblr_theme.html
Last active November 26, 2021 17:35
NPF powered tumblr theme prototype
<!--
Note that this is a very rough, incomplete prototype.
More info on how to possibly leverage it here: https://github.com/tumblr/docs/issues/49
-->
<!DOCTYPE html>
<html>
<head>
{MobileAppHeaders}
@cyle
cyle / store-state-in-url-hash.html
Created February 6, 2016 06:54
Store the state of your web app in the URL hash via JS
<!doctype html>
<html>
<head>
<title>storing state in the url hash, a demo</title>
<style>
body, input { font-family: sans-serif; font-size: 16px; }
div { margin: 3em; }
</style>
</head>
<body>
@cyle
cyle / giftagger.php
Created July 8, 2015 15:22
Tumblr GIF Tagger
<?php
/*
tumblr gif tagger
goes through your tumblr photo posts, finds .gifs, and tags em #gif
so that they can show up in https://tumblr.com/tv/@your-blog-here
this was made to be run via command line, i.e. `php giftagger.php`
@cyle
cyle / xcode-new-empty-app.md
Created June 9, 2015 19:05
creating a new empty xcode application project
  1. Create a new project in Xcode.
  2. Select the "Single View Application" template.
  3. Once created, delete the the files Main.storyboard, ViewController.h, ViewController.m
  4. Go into your project settings (Command+1, then click on the project name at the top), and delete the text "Main" under "Main Interface".
  5. Open AppDelegate.m and add in the missing window code. Your application:didFinishLaunchingWithOptions: method should look like:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 self.window.backgroundColor = [UIColor whiteColor];
@cyle
cyle / gist:de28409d8533bb1b62d2
Last active January 26, 2016 23:54
dank text parsing
// parse text to link-ify links, #hashtags, and @mentions
// input plain old text, get out the formatted text and info
// used by dankest.website and the dank platform https://github.com/cylesoft/dank
function parse_text($text) {
$home_url = 'https://dankest.website/';
$link_regex = '/\b(https?:\/\/)?(\S+)\.(\S+)\b/i';
$hashtag_regex = '/\#([^\s\#]+)/i';
$mention_regex = '/\@(\S+)/i';
$t = strip_tags($text);
$links_found = preg_match_all($link_regex, $t, $link_matches);