Skip to content

Instantly share code, notes, and snippets.

View virusvn's full-sized avatar

Nhan Nguyen virusvn

View GitHub Profile
@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');
//...
/**
@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 / 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),
@virusvn
virusvn / gist:95f3c3ffe83067e94e19
Created October 9, 2015 01:44
Configurações para o Sublime como IDE para PHP / JS
Finalmente, agora eu tenho tudo quase perfeito com o Sublime, só me falta mesmo é um Outline para fechar de vez.
Segue relação dos plugins que estou utilizando com o Sublime, bem como minhas configurações:
O primeiro package a instalar é o Package Control. A partir dele é possível intalar todos os outros pacotes executando Cmd+Shift+P (ou Ctrl para quem usa Linux/Windows), e buscando por "Package Control:Install Package".
Para instalar o Package Control, execute as instruções contidas nesta página:
https://packagecontrol.io/installation
Agora, chame o comando de instalação de pacotes e instale os seguintes pacotes.
<?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);
  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
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;
#!/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"