This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace TangChr | |
{ | |
public static class ExtendForEach | |
{ | |
public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action, Func<T, bool> condition) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.VisualBasic; | |
using Microsoft.VisualBasic.CompilerServices; | |
namespace TangChr.Tools | |
{ | |
public static class StringMatch | |
{ | |
public static bool IsWildcardMatch(string search, string source) | |
{ // Wildcard: * | |
return Operators.LikeString(source, search, CompareMethod.Text); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_file_info( $file ) { | |
$fp = fopen( $file, 'r' ); | |
$data = fread( $fp, 8192 ); // get first 8kb | |
fclose( $fp ); | |
// Capture all the header within first comment block | |
if( !preg_match( '!.*?/\*(.*?)\*/!ms', $data, $matches ) ) | |
return array(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Link Color</title> | |
</head> | |
<style> | |
body { | |
background: #2c3e50; | |
font-family: Arial, Verdana, sans-serif; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'tweet_parser.php'; | |
$userUrl = 'https://twitter.com/'; | |
$tagUrl = 'https://twitter.com/hashtag/'; | |
$my_tweet = "@TangChr: Here's a link: http://willitcompile.net, and here's a #hashtag."; | |
$formatted = parseTweet($my_tweet, $userUrl, $tagUrl); | |
$formatted2 = parseTweetPrefix($my_tweet, $userUrl, $tagUrl); | |
echo <<<HTML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace TangChr | |
{ | |
static class ArrayExtensions | |
{ | |
public static TSource[] Remove<TSource>(this TSource[] source, TSource item) | |
{ | |
var result = new TSource[source.Length - source.Count(s => s.Equals(item))]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Session Activator | |
Description: Enable the use of sessions ($_SESSION) in plugins and themes. | |
Version: 1.0.0 | |
Author: Christian Tang | |
Author URI: http://christiantang.dk | |
*/ | |
add_action('init', 'session_activator_start', 1); | |
add_action('wp_logout', 'session_activator_end'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="post-archive"> | |
{% for p in site.posts %} | |
<li> | |
{% assign fdate = p.date | date: '%b %Y' %} | |
{% if cur_date != fdate %} | |
{% assign cur_date = fdate %} | |
<h3>{{ p.date | date: '%B, %Y' }}</h3> | |
{% endif %} | |
<a href="{{ p.url }}">{{ p.title }}</a> | |
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: ruby | |
rvm: 2.3.3 | |
branches: | |
only: | |
- master | |
script: bundle exec rake test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rmdir _site /s /q | |
rmdir .sass-cache /s /q | |
del Gemfile.lock |
OlderNewer