Skip to content

Instantly share code, notes, and snippets.

@feczo
feczo / putty-gce.md
Last active July 23, 2020 13:14
How to use Compute Engine - GCE with putty
@etrepat
etrepat / traversing-example.md
Last active April 8, 2021 15:57
Traversing the Hierarchy Tree with Baum - An Example

The simplest way to traverse the hierarchy tree with Baum is by iterating through the children relation.

<?php

$root = Category::roots()->with('children')->first();

echo "<h3>{$root->name}</h3>";

foreach($root->children as $category) {
@jackey
jackey / controller.php
Created July 3, 2013 14:55
laravel 验证码
public function action_authcode() {
//随机生成一个4位数的数字验证码
$num="";
for($i=0;$i<4;$i++){
$num .= rand(0,9);
}
//4位验证码也可以用rand(1000,9999)直接生成
//将生成的验证码写入session,备验证页面使用
SESSION::put("authcode", $num);
//创建图片,定义颜色值
@hizhengfu
hizhengfu / sublimetext.bat
Last active December 3, 2020 09:00
sublime text window下右键菜单。 保存为bat文件,放入sublimetext安装文件夹与sublime_text同级,双击执行即可。 能打开带空格文件夹下的文件。 注意:这个文件最好是复制并用记事本保存,直接下载的有可能存在换行问题导致不能正常使用。 支持文件夹右键;
@Echo Off
Title SublimeText 右键菜单维护
Pushd %~dp0
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" (Set a="HKLM\SOFTWARE\Wow6432Node\SublimeText\sublimetext_backwnd" /v&Set b=%SystemRoot%\SysWOW64) Else (Set a="HKLM\SOFTWARE\SublimeText\sublimetext_backwnd" /v&Set b=%SystemRoot%\system32)
Rd "%b%\test_permission" >nul 2>nul
Md "%b%\test_permission" 2>nul||(Echo 请使用右键管理员身份运行&&Pause >nul&&Exit)
Rd "%b%\test_permission" >nul 2>nul
@topdown
topdown / CI_phpStorm.php
Created January 29, 2012 05:21
Code Completion for CodeIgniter in phpStorm
<?php die('This file is not really here!');
/**
* ------------- DO NOT UPLOAD THIS FILE TO LIVE SERVER ---------------------
*
* Implements code completion for CodeIgniter in phpStorm
* phpStorm indexes all class constructs, so if this file is in the project it will be loaded.
* -------------------------------------------------------------------
* Drop the following file into a CI project in phpStorm
* You can put it in the project root and phpStorm will load it.