Skip to content

Instantly share code, notes, and snippets.

Drupal 8.x search_api schema with ICUTokenizerFactory
<analyzer type="index">
<charfilter class="solr.HTMLStripCharFilterFactory"/>
<charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
<tokenizer class="solr.ICUTokenizerFactory"/>
<filter class="solr.StopFilterFactory"
ignoreCase="true"
words="stopwords.txt"
/>
<filter class="solr.WordDelimiterFilterFactory"
@tangzhen
tangzhen / mirror.sh
Created June 29, 2014 10:16
Switch NodeJS and Ruby Gem to China Taobao mirror
# switch npm
echo '\n#alias for cnpm\nalias cnpm="npm --registry=registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=http://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
#switch Ruby gem
gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
var Util = require('util');
var Https = require('https');
var Tls = require('tls');
/**
* HTTPS Agent for node.js HTTPS requests via a proxy.
* blog.vanamco.com/connecting-via-proxy-node-js/
*/
function HttpsProxyAgent(options)
{
@joyrexus
joyrexus / README.md
Last active August 21, 2023 16:59
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified

Overview

Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

@pekhee
pekhee / connection.php
Created April 5, 2014 23:56
Setup database connection for Eloquent outside of Laravel.
<?php // Namespace DB;
use Illuminate\Database\Capsule\Manager as Capsule;
class Connection {
public function __construct()
{
$this->capsule = new Capsule;
// Same as database configuration file of Laravel.
// to compile (using mingw-w64)
// g++ this_filename.c -lole32
// outputs current system volume (out of 0-100) to stdout, ex: output "23"
// mostly gleaned from examples here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd370839(v=vs.85).aspx
// download a compiled version here:
// https://sourceforge.net/projects/mplayer-edl/files/adjust_get_current_system_volume_vista_plus.exe.exe (updated, can set it too now!)
#include <windows.h>
#include <commctrl.h>
#include <mmdeviceapi.h>
#include <endpointvolume.h>
@simoncoulton
simoncoulton / gitkeep
Created January 8, 2014 05:42
Create empty gitkeep files in directories that are empty
find . -type d -empty -exec touch {}/.gitkeep \;
@msurguy
msurguy / eloquent.md
Last active February 8, 2022 03:13
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

{
"directory": "components"
}