Skip to content

Instantly share code, notes, and snippets.

View pobing's full-sized avatar

Jed pobing

View GitHub Profile
@pobing
pobing / Preferences.sublime-settings
Created February 23, 2022 09:06
Preferences.sublime-settings of User
{
"auto_complete": true,
"auto_complete_commit_on_tab": true,
"color_scheme": "Monokai.sublime-color-scheme",
"copy_with_empty_selection": true,
"dictionary": "Packages/Language - English/en_US.dic",
"ensure_newline_at_eof_on_save": true,
"font_size": 20,
"ignored_packages":
[
desc "update zone data"
task :find_bad_js => :environment do
JS_PATH = "/lit/app/assets/javascripts/**/*.js";
Dir[JS_PATH].each do |file_name|
puts "\n#{file_name}"
puts Uglifier.compile(File.read(file_name))
end
end
@pobing
pobing / 大学.json
Created May 11, 2018 09:02 — forked from zerosrat/大学.json
中国大学名单
{
"湖南省": [
"湘潭大学",
"吉首大学",
"湖南大学",
"中南大学",
"湖南科技大学",
"长沙理工大学",
"湖南农业大学",
"中南林业科技大学",
@pobing
pobing / golbal.coffee
Last active January 30, 2018 08:01
Some global Javascript method
window.TBS ||= {}
Date::format = (format) ->
o =
'M+': @getMonth() + 1
'd+': @getDate()
'h+': @getHours()
'm+': @getMinutes()
's+': @getSeconds()
'q+': Math.floor((@getMonth() + 3) / 3)
@pobing
pobing / rails_template.rb
Created March 23, 2017 10:14
use rails template create project
## Gem part
remove_file 'Gemfile'
run 'touch Gemfile'
add_source 'https://gems.ruby-china.org'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
@keyframes spin {
0% {
transform:rotate(0deg);
}
100% {
transform:rotate(360deg);
}
}
.animate-spin {
@pobing
pobing / jsArraySort.coffee
Created February 2, 2016 06:55
js array sort by two propertys
comparator: (prev,next) ->
return 1 if prev.get('page_number') > next.get('page_number')
return -1 if prev.get('page_number') < next.get('page_number')
if prev.get('page_number') is next.get('page_number')
return prev.get('number') - next.get('number')
return 0
@pobing
pobing / checkboxSelect.coffee
Last active February 2, 2016 06:57
js checkAll or subCheck
attached: ->
$subQuestion = @$("input[name='question_ids[]']")
checkedLengh = @$("input[name='question_ids[]']:checked").length
allChecked = checkedLengh > 0 and $subQuestion.length is checkedLengh
@$(".question-check-all").prop("checked", allChecked)
checkAll: (e) ->
checkboxes = $('input[name="question_ids[]"]')
_.each checkboxes, (box) =>
@pobing
pobing / gist:b7b3bba28c7b76b61ba6
Last active August 29, 2015 14:24
ruby tips 1
#flatten.uniq 去数组中的重复元素
@my_orgunits = (current_user.orgunits + current_user.groups+ current_user.watch_open_groups).flatten.uniq
# use db
ActiveRecord::Base.connection.execute("use db")
# gsub
Mblog.find_each do |mblog|
unless mblog.content.nil?
mblog.content=mblog.content.gsub(/\[(\w+)\]/) do |c|
@pobing
pobing / gist:5ab97690230cd564241c
Created December 24, 2014 07:53
Ruby query db res and generate csv file
# encoding: utf-8
require 'csv'
desc 'Get all user email'
task :send_coupon do
date = Time.now.strftime("%Y%m%d%H%M%S")
path = "tmp/send_coupon_emails_#{date}.csv"
CSV.open(path, "wb") do |csv|
header = ["email","created_at","survey_count","passport_id"]