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
package main | |
import ( | |
"log" | |
// "net/http" | |
"github.com/go-macaron/session" | |
_ "github.com/go-macaron/session/redis" | |
"gopkg.in/macaron.v1" | |
) |
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 | |
private function resendActivation($email) { | |
$user = User::find()->where(['email' => $email])->one(); | |
$baseUrl = join('', [Yii::$app->params['absolute_url'], Yii::$app->urlManager->baseUrl]); | |
$yiiTransport = Yii::$app->mailer->transport; | |
$view = Yii::$app->mailer->render('user_activation', ['baseUrl' => $baseUrl, 'model' => $user, | |
'userProfile' => $user->userProfile | |
]); | |
$transport = \Swift_SmtpTransport::newInstance($yiiTransport->getHost(), $yiiTransport->getPort()) |
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 DemoController extends Controller | |
{ | |
private function migrate($cmd=array()) { | |
$commandPath = Yii::app()->getBasePath() . '/commands'; | |
$runner = new CConsoleCommandRunner; | |
$runner->addCommands($commandPath); | |
$commandPath = Yii::getFrameworkPath() . '/cli/commands'; |
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
SELECT table_schema "DB Name", | |
ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" | |
FROM information_schema.tables | |
where table_schema='DATABASE_NAME' | |
GROUP BY table_schema; |
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
# Reload/recompile code before each request in development only using Plug & Mix. | |
# Assumes MyApp.Router is a plug that handles actual routing. | |
def MyApp.Main do | |
use Plug.Builder | |
plug :reload | |
plug :dispatch | |
def reload(conn, _opts) do | |
if Mix.env == :dev, do: Mix.Tasks.Compile.Elixir.run(["--ignore-module-conflict"]) |
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
server { | |
listen 443 ssl; | |
server_name xxx.xx.io | |
ssl on; | |
ssl_certificate /etc/asterisk/certs/xxx.io.pem; | |
ssl_certificate_key /etc/asterisk/certs/xxx.io.key; | |
ssl_session_timeout 5m; |
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
defmodule RenameBooks do | |
@book_path "/home/user/Downloads" | |
def get_files do | |
with {:ok, files} <- File.ls(@book_path) do | |
files | |
else | |
{:error, reason} -> | |
reason | |
end |
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
"use strict"; | |
// Load plugins | |
const autoprefixer = require("autoprefixer"); | |
const browsersync = require("browser-sync").create(); | |
const cp = require("child_process"); | |
const cssnano = require("cssnano"); | |
const del = require("del"); | |
const eslint = require("gulp-eslint"); | |
const gulp = require("gulp"); |
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
#!/usr/bin/env elixir | |
defmodule Canvas do | |
@behaviour :wx_object | |
@title "Canvas Example" | |
@size {600, 600} | |
def start_link() do | |
:wx_object.start_link(__MODULE__, [], []) |
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 | |
namespace app\components; | |
class AssetBundle extends \yii\web\AssetBundle | |
{ | |
public function publish($am) | |
{ | |
parent::publish($am); | |
if (isset($this->basePath, $this->baseUrl) && ($converter = $am->getConverter()) !== null) { |
OlderNewer