Skip to content

Instantly share code, notes, and snippets.

View ddnode's full-sized avatar

Boy ddnode

View GitHub Profile
@ddnode
ddnode / PrimeFactors.php
Created December 7, 2015 01:06
PrimeFactors
<?php
class PrimeFactors {
/**
* @param $number
* @return array
*/
public function generate($number)
{
$primes = [];
for ($candidate = 2; $number > 1; $candidate++)
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "UTF-8",
"font_size": 14,
"ignored_packages":
[
"Vintage"
set $boost "";
set $boost_query "_";
if ( $request_method = GET ) {
set $boost G;
}
if ($http_cookie !~ "DRUPAL_UID") {
set $boost "${boost}D";
}
@ddnode
ddnode / nginx
Created January 7, 2014 02:19
Nginx私有文件系统重定向
location ^~ /system/files/ {
rewrite ^ /index.php;
}
@ddnode
ddnode / node-type.php
Created November 10, 2013 01:26
Page templates depending on node type drupal7
<?php
function themename_preprocess_page(&$variables) {
if (!empty($variables['node'])) {
$variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->type;
}
}
?>
<?php
#inline-block {
 display: -moz-inline-stack;
 display: inline-block;
 vertical-align: middle;
 *vertical-align: auto;
 zoom: 1;
*display: inline;
}
@ddnode
ddnode / hide-text.css
Created June 6, 2013 07:40
css隐藏文本
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
@ddnode
ddnode / gist:5597135
Last active December 17, 2015 10:48 — forked from padolsey/gist:527683
Javascript: Detect IE
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@ddnode
ddnode / theme.php
Created May 10, 2013 09:51
Drupal根据星期切换主题
<?php
/**
* Implements hook_custom_theme().
*/
function mysite_custom_theme() {
// An array of themes for each day of the week.
// These themes have to be installed and enabled.
$themes = array();
$themes[0] = 'garland';
$themes[1] = 'bartik';
@ddnode
ddnode / 电影
Last active December 17, 2015 04:39
电影清单
【最费脑力的14部电影】
1、《盗梦空间》
2、《记忆裂痕》
3、《生死停留》
4、《死亡幻觉》
5、《禁闭岛》
6、《穆赫兰道》
7、《蝴蝶效应》
8、《恐怖游轮》
9、《伤城》