Skip to content

Instantly share code, notes, and snippets.

View oxyc's full-sized avatar

oxyc

View GitHub Profile
#!/usr/bin/env drush
function insert_bool_value_based_on_query() {
// where kuva exists
//$result = db_query("SELECT entity_id FROM {field_data_field_horeca_kuva} WHERE language = 'fi'");
// where kuva does not exist
$result = db_query("SELECT node.nid FROM {node} LEFT JOIN {field_data_field_horeca_kuva} h ON node.nid = h.entity_id WHERE node.type = 'tuote' AND h.field_horeca_kuva_fid IS null AND node.language = 'fi'");
$nids = array();
" Move windows around
<C-w>r
<C-w>R
" Goto last line before jump
''
" Consider using, but we need to find a better char than [
https://github.com/tpope/vim-unimpaired/blob/master/plugin/unimpaired.vim
/**
* Implements hook_menu_alter().
*
* Redefine the node translation link as a context inline link so it appears as
* a contextual link.
*
* Redirect comment reply
*/
function misc_hooks_menu_alter(&$items) {
$items['node/%node/translate']['context'] = MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE;
# VARNISH -c 300
Concurrency Level: 300
Time taken for tests: 24.471 seconds
Complete requests: 1000
Failed requests: 9
(Connect: 0, Receive: 0, Length: 9, Exceptions: 0)
Write errors: 0
Total transferred: 30368204 bytes
# Only allow PURGE requests from the system itself.
acl purge {
"127.0.0.1";
}
sub custom__recv {
# See "acl purge" above
if (req.request == "PURGE") {
if (!client.ip ~ purge) {
#!/usr/bin/env drush
<?php // for syntaxhighlight
function active_comments_all() {
$result = db_query("SELECT node.nid FROM {node} WHERE node.type = 'tuote'");
$nids = array();
foreach($result as $record) {
$nids[] = $record->nid;
}
# This is a basic VCL configuration file for varnish. See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# Default backend definition. Set this to point to your content
# server.
#
#include "normal.vcl";
#include "esi.vcl";
include "cache_control.vcl";
#!/bin/bash
get_value() { drush core-status --pipe --show-passwords "$1"; }
e_arrow() { echo -e " \033[1;33m➜\033[0m $@"; }
host="$@"
read -d '' dump_cmd <<'EOF'
tmp_file="sql_transfer_db_dump.sql.tar.gz"
if [ ! -f $tmp_file ]; then
@oxyc
oxyc / a
Created June 5, 2012 08:54
for i in *; do name=$(echo $i | sed 's/\.png/-small\.png/g'); mv $i $name; done
$list: harka hirvi kala kalkkuna kana kasvis nauta poro sika;
width: sprite-sprite-width(harka-small);
height: sprite-sprite-height(harka-small);
@each $img in $list {
&.#{$img} { @include sprite-sprite(#{$img}-small); }
}