Skip to content

Instantly share code, notes, and snippets.

View virusvn's full-sized avatar

Nhan Nguyen virusvn

View GitHub Profile
@virusvn
virusvn / zsh
Created December 23, 2019 03:48
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
#export ZSH_THEME="robbyrussell"
export ZSH_THEME="random"
@virusvn
virusvn / mac-applications.md
Last active December 27, 2019 06:44
My Mac applications

MUST

Ultilities

  • Keka
  • KeyCastr
  • Alfred
  • OmniDiskSweeper
  • Poedit
  • OpenKey
@virusvn
virusvn / streamlit_remote_runner.py
Last active October 10, 2019 03:03
Run Streamlit apps inside other apps by remote script
from typing import List, Dict
import logging
import json
import urllib.request
import streamlit as st
# Get an instance of a logger
logger = logging.getLogger(__name__)
# Change this json to your file
@virusvn
virusvn / iframe-tracking.js
Created August 8, 2017 09:10
Execute a function to track (Facebook & Line...) iFrame's click
<!--
@Author: Nhan Nguyen
@Description: The library iframetracker is good, but because the script to generate iframe is asynchronous,
so we can't setup $(document).ready() work properly.
The solution is combined:
- Track by tagName is IFRAME for the first click
- Then, track by iframeTracker for nth times click
-->
<!-- https://github.com/vincepare/iframeTracker-jquery -->
@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