Skip to content

Instantly share code, notes, and snippets.

View virusvn's full-sized avatar

Nhan Nguyen virusvn

View GitHub Profile
fastcgi_split_path_info ^(.*\.php)(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTP_HOST $host;
fastcgi_param SERVER_NAME $host;
fastcgi_intercept_errors on;
fastcgi_index index.php;
  1. #####Clone repo git clone --recursive https://github.com/ushahidi/Lamu

  2. #####Initialize/Update submodules git submodule update --init --recursive

  3. #####Use composer to install dependencies You can get composer here

  • Open cmd and cd to the Ushahidi v3 directory
  • run composer install
<?php
public function convert_usable_format($file){
$buf = mb_convert_encoding(file_get_contents($file), "UTF-8", "SJIS-WIN");
$buf = str_replace(array("\r\n", "\n", "\r"), "m9(^v^)", $buf);
$buf = str_replace("m9(^v^)", "\r\n", $buf);
$handle = tmpfile();
fwrite($handle, $buf);
rewind($handle);
@virusvn
virusvn / checkPresenter.php
Created November 19, 2012 09:30
checkPresenter
$presenterName = Rights::module()->presenterName;
$isPresenter = false;
foreach($rights as $r){
if($r->name == $presenterName){
$isPresenter = true;
}
}
@virusvn
virusvn / gist:4124142
Created November 21, 2012 10:25
check permission
$presenterName = Rights::module()->presenterName;
$isPresenter = false;
foreach($rights as $r){
if($r->name == $presenterName){
$isPresenter = true;
}
}
@virusvn
virusvn / download_test.php
Created December 13, 2015 15:56 — forked from sharapeco/download_test.php
Content-Disposition: attachment で日本語ファイル名をダウンロードさせるテスト
<?php
$t = isset($_GET['t']) ? $_GET['t'] : null;
$org = '此のファイル test.php';
$fn = array(
'A: UTF-8 Raw' => 'Content-Disposition: attachment; filename="' . $org . '"',
'B: UTF-8 URL Encoded' => 'Content-Disposition: attachment; filename="' . rawurlencode($org) . '"',
'C: UTF-8 Base64 Encoded' => 'Content-Disposition: attachment; filename="=?utf-8?B?' . base64_encode($org). '?="',
'D: RFC 2231' => 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode($org),
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
#!/bin/sh
#
# chkconfig: 35 99 99
# description: Node.js /home/nodejs/sample/app.js
#
. /etc/rc.d/init.d/functions
USER="nodejs"
@virusvn
virusvn / meteor-async.md
Created June 21, 2016 11:20 — forked from possibilities/meteor-async.md
Meteor Async Guide

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

@virusvn
virusvn / background.js
Created May 31, 2017 05:41 — forked from delfrrr/background.js
react-native requestAnimationFrame and d3-interpolate
//this is an example of background animation from my weather comparsion app
//you can get early build of app at http://zowni.com
//full source of background.js below
const React = require('react');
const Svg = React.createFactory(require('react-native-svg').Svg);
const {interpolate} = require('d3-interpolate');
//...
/**