Skip to content

Instantly share code, notes, and snippets.

@mderazon
mderazon / app.js
Last active December 26, 2015 23:19
i18n simple express server
var express = require('express');
var app = express();
app.set('views', __dirname + '/views');
app.get('/', function(req, res) {
console.log('Hello i18n');
res.render('index.ejs');
});
@mderazon
mderazon / index.ejs
Last active December 26, 2015 23:19
i18n simple view
<html>
<head>
<title>node, express and i18n</title>
</head>
<body>
<h1>Hello i18n</h1>
</body>
</html>
@mderazon
mderazon / i18n.js
Created October 30, 2013 09:48
i18n module
var i18n = require('i18n');
i18n.configure({
// setup some locales - other locales default to en silently
locales:['en', 'iw'],
// where to store json files - defaults to './locales' relative to modules directory
directory: __dirname + '/locales',
defaultLocale: 'en',
@mderazon
mderazon / app.js
Created October 30, 2013 10:43
adding i18n in express app
var express = require('express');
var i18n = require('./i18n');
var app = express();
app.set('views', __dirname + '/views');
app.use(i18n);
app.get('/', function(req, res) {
console.log(res.__('Hello i18n'));
@mderazon
mderazon / index.ejs
Created October 30, 2013 11:01
i18n add __ to view
<html>
<head>
<title>node, express and i18n</title>
</head>
<body>
<h1><%= __('Hello i18n')%></h1>
</body>
</html>
@mderazon
mderazon / MainActivity.java
Last active March 13, 2016 01:53
a main activity with the new ClearableAutoCompleteTextView and a method to toggle between the visibility of the the search icon and the search box
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// ......
// ......
ActionBar actionBar = getSupportActionBar(); // you can use ABS or the non-bc ActionBar
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_HOME
| ActionBar.DISPLAY_HOME_AS_UP); // what's mainly important here is DISPLAY_SHOW_CUSTOM. the rest is optional
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

Keybase proof

I hereby claim:

  • I am mderazon on github.
  • I am mderazon (https://keybase.io/mderazon) on keybase.
  • I have a public key whose fingerprint is A80C EB00 A6B8 EC21 47A3 E5B9 75D2 C988 4BF7 DC31

To claim this, I am signing this object:

#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
var express = require('express')
var multer = require('multer')
var storage = multer.memoryStorage()
var upload = multer({ storage: storage })
var app = express()
app.post('/upload', upload.single('users.csv'), function (req, res, next) {
if (!req.file) {
import React from 'react'
import classNames from 'classnames'
import request from 'superagent'
export default class FileUploader extends React.Component {
constructor (props) {
super(props)
this.state = {
fileName: '',