I hereby claim:
- I am jasonreposa on github.
- I am jasonmbt (https://keybase.io/jasonmbt) on keybase.
- I have a public key ASDiitpNoGnZJM7yRfi3qu_eT2Z2XLq74xm-s6mqcg1oGgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| if ($key == '@attributes') { | |
| continue; | |
| } |
| echo 0 == '@attributes' ? 'YES' : 'NO'; | |
| echo "<br>\n"; | |
| echo 0 === '@attributes' ? 'YES' : 'NO'; |
| html = Nokogiri::HTML(the_content) | |
| ... | |
| html.xpath("//ul[@id='sharebar']").each(&:remove) | |
| html.xpath('//script').each(&:remove) | |
| html.xpath('//@onclick').each(&:remove) | |
| html.xpath('//@class').each(&:remove) | |
| html.xpath('//@style').each(&:remove) | |
| ... |
| // http://www.evanmiller.org/how-not-to-sort-by-average-rating.html | |
| // http://gist.github.com/raw/63002/b53853727856bad494dcbb7ffed4fc17f289af92/gistfile1.rb | |
| // $z is the pnormaldist with power = 0.05. I.e., pnormaldist(1-power/2) | |
| function score($pos, $n) { | |
| if ($n == 0) { return 0; } | |
| $z = 1.95996397158435; | |
| $phat = 1.0*$pos/$n; | |
| return ($phat + $z*$z/(2*$n) - $z * sqrt(($phat*(1-$phat)+$z*$z/(4*$n))/$n))/(1+$z*$z/$n); | |
| } |
| function my_head() { | |
| global $post; | |
| if (is_single()) { | |
| $short_post = false; | |
| $words = preg_split('/\s+/', strip_tags($post->post_content), -1, PREG_SPLIT_NO_EMPTY); | |
| if (count($words) < 300) { | |
| $short_post = true; | |
| } | |
| } |
| function array_psplice(&$array, $offset = 0, $length = 1) { | |
| $return = array_slice($array, $offset, $length, true); | |
| foreach ($return as $key => $value) { | |
| unset($array[$key]); | |
| } | |
| return $return; | |
| } |
| // Originally built for http://www.mybanktracker.com/bank-news/ | |
| function mbt_img_caption_shortcode($val, $attr, $content = null) { | |
| extract(shortcode_atts(array( | |
| 'id' => '', | |
| 'align' => 'alignnone', | |
| 'width' => '', | |
| 'caption' => '' | |
| ), $attr)); | |
| // if it contains a pipe character, we know it's ours |