This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$locale_tags = [ | |
'en_US'=>[ | |
'title'=>'hello', | |
'description'=>'hello world' | |
], | |
'fr_FR'=>[ | |
'title'=>'Bonjour', | |
'description'=>'Bonjour tout le monde' | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class TemplateUtil{ | |
public static function evalTemplate($template_file, $vars) | |
{ | |
ob_start(); | |
foreach($vars as $key=>$val){ | |
${$key} = $val; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.linear_model import LogisticRegression | |
import requests | |
import numpy as np | |
import random | |
sample_num = 1400 | |
dimension = 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client = Twitter::REST::Client.new do |config| | |
config.consumer_key = "..." | |
config.consumer_secret = "..." | |
end | |
res = Twitter::REST::Request.new(client, :get, '/1.1/application/rate_limit_status.json').perform | |
#ex. | |
p res[:resources][:search][:'/search/tweets'][:remaining] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails_root = File.expand_path('../../', __FILE__) | |
listen "#{rails_root}/tmp/sockets/unicorn.sock" | |
pid "#{rails_root}/tmp/pids/unicorn.pid" | |
stdout_path "#{rails_root}/log/#{:stage}.log" | |
stderr_path "#{rails_root}/log/#{:stage}.log" | |
timeout 60 | |
worker_processes Integer(ENV["WEB_CONCURRENCY"] || 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Based on instructions found here: http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat#FFMpegInstallationonCentOSandRedHat-InstallX264 | |
if [ "`/usr/bin/whoami`" != "root" ]; then | |
echo "You need to execute this script as root." | |
exit 1 | |
fi | |
cat > /etc/yum.repos.d/centos.repo<<EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Field } from 'redux-form'; | |
const FileInput = (props) => ( | |
<span> | |
<Field name={props.name} component="input" type="file" label={props.label} /> | |
</span> | |
); | |
export default FileInput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component} from 'react' | |
import classNames from 'classnames' | |
import Button from 'material-ui/Button' | |
import Tooltip from 'material-ui/Tooltip' | |
import { withStyles } from 'material-ui/styles' | |
const actionMargin = 20 | |
const actionSize = 40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (response) => { | |
const {headers, ...rest} = response | |
return { | |
...rest, | |
headers: { | |
'Access-Control-Allow-Origin': '*', | |
...headers | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install -y libpam-google-authenticator | |
ga_profile=$(cat << EOS | |
#!/bin/sh | |
if [ "$USER" != "root" ]; then | |
if [ ! -f "$HOME/.google_authenticator" ]; then | |
trap 'exit' SIGINT | |
echo "Initialize google-authenticator" |
OlderNewer