Skip to content

Instantly share code, notes, and snippets.

View cisolarix's full-sized avatar
🌻
Cool

Yanming Deng cisolarix

🌻
Cool
View GitHub Profile
@cisolarix
cisolarix / 2015 年读的书.md
Last active August 29, 2015 14:14
2015 年读的书
@cisolarix
cisolarix / permission_actions.rb
Last active August 29, 2015 14:17
获取 permission actions 列表
controllers = Dir.new("#{Rails.root}/app/controllers/admin").entries
controllers.each do |controller|
if controller =~ /_controller/
cont = controller.camelize.gsub(".rb","")
cont1 = controller.gsub("_controller.rb", "")
(eval("Admin::#{cont}.action_methods")).sort.each {|met|
puts "admin/#{cont1}##{met}"
}
end
end
@cisolarix
cisolarix / seeds.rb
Last active August 29, 2015 14:17 — forked from seyhunak/seeds.rb
unless Rails.env.production?
connection = ActiveRecord::Base.connection
connection.tables.each do |table|
connection.execute("TRUNCATE #{table}") unless table == "schema_migrations"
end
sql = File.read('db/import.sql')
statements = sql.split(/;$/)
statements.pop
江西经济发展研究院
研究生学院
校办公室
国际学院
档案馆
信息管理学院
资产管理处
外国语学院
马克思主义学院
老干处
@cisolarix
cisolarix / xunlei_download_links_grabber.rb
Created May 10, 2015 02:38
xunlei_download_links_grabber
@cisolarix
cisolarix / live reload.md
Created June 18, 2015 05:45
live reload

bundle exec guard -P livereload

@cisolarix
cisolarix / SPL_delete_dir.php
Created July 26, 2012 03:51
recursively deleting directory with sub-directories and files using SPL in PHP
function recursiveDelDirecoty( $dir, $delMe = FALSE ) {
$dir = realpath( $dir );
try{
$it = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $dir, RecursiveDirectoryIterator::SKIP_DOTS ), RecursiveIteratorIterator::CHILD_FIRST );
foreach( $it as $i ) {
if ( $i->isDir() ) {
rmdir( $i->getRealPath() );
echo "删除". $i . "目录成功";
}else{
unlink( $i->getRealPath() );
@cisolarix
cisolarix / Readme.md
Created July 28, 2017 02:40 — forked from mxstbr/Readme.md
Enable tab completion for JSX with Emmet in Atom

Enable tab completion for JSX with Emmet in Atom

This guide assumes you have the emmet and language-babel packages already installed in Atom

Gif of the tab completion working

  1. Open the keymap.cson file by clicking on Atom -> Keymap… in the menu bar
  2. Add these lines of code to your keymap:
'atom-text-editor[data-grammar~="jsx"]:not([mini])':
@cisolarix
cisolarix / config.rb
Created August 3, 2017 12:10 — forked from guiman/config.rb
Example mina deploy script using docker
require 'mina/git'
require 'mina/nginx'
set :application, 'your_app_name'
set :domain, 'your_server'
set :user, 'ubuntu'
set :deploy_to, '/location/to/deploy'
set :app_path, "#{deploy_to}/#{current_path}"
set :repository, 'your_repo'
set :branch, 'master'