View new-browser.js
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
// node_modules/gemini/lib/browser/new-browser.js | |
open(url, params) { | |
params = _.defaults(params || {}, { | |
resetZoom: false | |
}); | |
// console.log(this._currentUrl); | |
if( this._currentUrl == url ) { |
View gist:8fad016ac7490729baeb4a585b92d634
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
public function wp_rewrite_rules() { | |
$this->rules = get_option('rewrite_rules'); | |
if ( empty($this->rules) ) { | |
$this->matches = 'matches'; | |
$this->rewrite_rules(); | |
if ( ! did_action( 'wp_loaded' ) ) { | |
add_action( 'wp_loaded', array( $this, 'flush_rules' ) ); | |
return $this->rules; | |
} |
View update_posts_content.php
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 | |
/** | |
* Front to the WordPress application. This file doesn't do anything, but loads | |
* wp-blog-header.php which does and tells WordPress to load the theme. | |
* | |
* @package WordPress | |
*/ | |
/** | |
* Tells WordPress to load the WordPress theme and output it. |
View widget-opened-topics.php
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 | |
class Opened_Topics_Widget extends WP_Widget { | |
public function __construct() { | |
parent::__construct( | |
'widget_display_topics', // Base ID | |
__( 'Recent Topics', 'bbpress' ), // Name | |
array( 'description' => __( 'A list of recent topics, replied by customers.', 'bbpress' ), ) // Args | |
); | |
} |
View findPrimesSum.py
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
import math | |
n = 2000000 | |
def primesTo(lim): | |
primes = [2] | |
t = 0 | |
sieve = [False] * lim | |
crosslim = int(math.sqrt(lim)) |
View findPrime.js
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
var g = 0; | |
var n = 10001; | |
var i = 1; | |
var isPrime = function(x) { | |
if( x < 2) return false; | |
if(x < 4) return true; | |
if( x % 3 == 0 || x % 2 == 0) return false; |
View fridayCome.js
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
var fridayTime = function() { | |
var now = new Date(), | |
day = now.getDay(), | |
date = now.getDate(), | |
fridayDate = date + (5 - day), | |
friday = new Date(2016, now.getMonth(), fridayDate), | |
timeDiff = Math.abs(friday.getTime() - now.getTime()), | |
msToTime = function(s) { | |
var ms = s % 1000; | |
s = (s - ms) / 1000; |
View gist:0831aaa59b1b87e11e31
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 | |
/* | |
Password logger for wordpress | |
*/ | |
function log_login_success($username) { | |
log_login_attempts($username, true); | |
} | |
function log_login_fail($username) { | |
log_login_attempts($username, false); |