Skip to content

Instantly share code, notes, and snippets.

View hfcorriez's full-sized avatar
🏠
Working from home

hfcorriez hfcorriez

🏠
Working from home
View GitHub Profile
;(function (id, name, context, definition) {
// --------------------------------------------------------------------------
// Dependencies
//
// This is an attempt to make this library compatible with multiple module
// formats. Other UMD implementations do not take into account dependencies:
// Example: https://github.com/ForbesLindesay/umd/blob/master/template.js
//
// **NOTE: Named AMD modules are more suitable for libraries as it provides
@hfcorriez
hfcorriez / fully_async_ga.js
Created July 7, 2017 10:42
Fully async ga
if (!DDAsyncLoad) {
function DDAsyncLoad(cb) {
if (window.attachEvent) {
window.attachEvent('onload', cb);
} else {
window.addEventListener('load', cb, false);
}
}
}
@hfcorriez
hfcorriez / async_raven.js
Last active December 14, 2018 09:01
Load raven js async (ga.js like)
!function(n,e,a,t,o,r,s,c){var c=c||[];n.onerror=function(n,e,a){c.push([n,e,a])};var i=!1;
r=e.createElement(a),s=e.getElementsByTagName(a)[0],r.async=1,r.src=t,r.crossorigin="anonymous",
r.onreadystatechange=r.onload=function(){if(!i){Raven.config(o).install();for(var n=0;n<c.length;n++)Raven.captureMessage("Message: "+c[n][0]+" - URL: "+c[n][1]+" - Line: "+c[n][2])}i=!0}
,s.parentNode.insertBefore(r,s)
}(window,document,"script","https://cdn.ravenjs.com/3.16.0/raven.min.js","https://xx@sentry.io/xx");
@hfcorriez
hfcorriez / brewfix.sh
Created February 9, 2014 10:37
Brew update failed solution
cd $(brew --prefix)
git reset --hard HEAD
brew update
@hfcorriez
hfcorriez / apc.ini
Created July 16, 2013 05:21
Best apc configuration.
[APC]
extension=apc.so
apc.enabled=1
apc.shm_segments=1
;32M per WordPress install
apc.shm_size=128M
;Relative to the number of cached files (you may need to watch your stats for a day or two to find out a good number)
apc.num_files_hint=7000
@hfcorriez
hfcorriez / networking_restart.sh
Last active December 16, 2015 02:39
重启网络,解决到公司不能访问内网的问题
ifconfig en0 down
ifconfig en1 down
route -n flush
ifconfig en0 up
ifconfig en1 up
<?php
$data = (object)array(
"html" => "<foo bar=\"baz\"/> &amp;",
"arabic" => "العربية al-ʿarabiyyah, IPA: [æl ʕɑrɑˈbijjɐ], or عربي ʿarabī",
"hebrew" => "עִבְרִית, Ivrit",
"chinese" => "汉语/漢語 Hanyu; 华语/華語 Huáyǔ; 中文 Zhōngwén",
"korean" => "한국어/조선말",
"japanese" => "日本語 Nihongo",
"umlauts" => "äüöãáàß",
@hfcorriez
hfcorriez / api.php
Created November 5, 2012 06:32
Print ip with php
<?php
echo ip();
function ip()
{
if ($ip = getenv('X_FORWARDED_FOR')) {
return $ip;
} elseif ($ip = getenv('CLIENT_IP')) {
return $ip;
@hfcorriez
hfcorriez / php-yaf.rb
Created October 23, 2012 15:54
brew php-yaf
class Php53Yaf < AbstractPhpExtension
homepage 'http://pecl.php.net/package/yaf'
url 'http://pecl.php.net/get/yaf-2.2.2.tgz'
sha1 '826f85b7b641a7418110f73f823749509c58b1b7'
head 'https://svn.php.net/repository/pecl/yaf/trunk/', :using => :svn
depends_on 'autoconf' => :build
depends_on 'php53' if build.include?('with-homebrew-php') && !Formula.factory('php53').installed?
depends_on 'pcre'
@hfcorriez
hfcorriez / home.js
Created October 3, 2012 13:50
async to get all data
async.parallel({
tasks: function(fn) {
mongo.model('Task').find(function(err, data) {
fn(err, data)
});
},
projects: function(fn) {
mongo.model('Project').find(function(err, data) {
fn(err, data)
});