Skip to content

Instantly share code, notes, and snippets.

View ddnode's full-sized avatar

Boy ddnode

View GitHub Profile
@ddnode
ddnode / hide-text.css
Created June 6, 2013 07:40
css隐藏文本
.hide-text {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
}
#inline-block {
 display: -moz-inline-stack;
 display: inline-block;
 vertical-align: middle;
 *vertical-align: auto;
 zoom: 1;
*display: inline;
}
@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
@ddnode
ddnode / nginx
Created January 7, 2014 02:19
Nginx私有文件系统重定向
location ^~ /system/files/ {
rewrite ^ /index.php;
}
set $boost "";
set $boost_query "_";
if ( $request_method = GET ) {
set $boost G;
}
if ($http_cookie !~ "DRUPAL_UID") {
set $boost "${boost}D";
}
{
"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"
@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++)