Skip to content

Instantly share code, notes, and snippets.

Available for Hire, Rails Developer with 4 years of Experience

Cheng Zheng 1c7

Available for Hire, Rails Developer with 4 years of Experience
Block or report user

Report or block 1c7

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cd /var/www/
envsubst < docker-stack.yml > file.tmp
sudo docker stack deploy --with-registry-auth --compose-file file.tmp buddy-cd-app
1c7 /
Created Feb 10, 2019
Gitlab remote to Github remote & vice versa
## to Gitlab
cd existing_repo
git remote rename origin old-origin
git remote add origin
git push -u origin --all
git push -u origin --tags
## Gitlab back to Github
cd existing_repo
git remote rm origin
1c7 / .gitlab-ci.yml
Created Feb 2, 2019
.gitlab-ci.yml example
View .gitlab-ci.yml
image: gitlab/dind
- build_and_publish_image
stage: build_and_publish_image
- docker login -u [username] -p [password]
- docker build -t .
1c7 / job.rb
Created Jan 23, 2019
Slack webhook example curl->Ruby
View job.rb
class SlackIdVerifyJobJob < ApplicationJob
queue_as :default
def perform()
# curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}'
# Equivalent ruby code:
url = ""
options = {
body: {"text": "Hello, World!"}.to_json,
1c7 / example.js
Last active Jan 8, 2019
View example.js
data: {
offsetY: 0,
if( == 0){
var that = this;
1c7 / snippet_for_blog.html
Created Jan 8, 2019
View snippet_for_blog.html
<image class='图片position:relative' src="{{例子}}" bind:tap='click_image' mode='widthFix'>
<view catch:tap='删除标签函数' data-tag="{{i}}" class='tag_on_image' wx:key="{{i}}" wx:for='{{tag_array}}' wx:for-item='i' data-item='{{i}}' style="position:absolute; left:{{i.x}}px;top:{{i.y}}px;">
1c7 /
Created Jan 1, 2019
test Ghost+Github
echo "Hello Ghost from Github"
1c7 / copy-your-subreddit-list.js
Last active Nov 30, 2018
copy your subreddit list
View copy-your-subreddit-list.js
// Step 1: visit
// Step 2:
// copy & past these into Chrome developer tool
var array = []
document.querySelectorAll('.subscription-box ul li').forEach(function(element) {
var subreddit = element.querySelector('a[class="title"]')
subreddit_name = subreddit.innerText
1c7 / grap youtube playlist title.js
Created Nov 24, 2018
grap youtube playlist title
View grap youtube playlist title.js
var original = $('#playlist tr span').text().split('\n')
var res = original.filter((element, index) => {
return index % 2 == 0;
var result = => s.trim());
1c7 / show_finger_real_time.js
Last active Nov 19, 2018
Show number of finger touch screen in Real time
View show_finger_real_time.js
$("#camera-controller").on("touchstart", (e) => {
var fingerOnScreen = e.originalEvent.targetTouches.length;
$("#camera-controller").on("touchend", (e) => {
var fingerOnScreen = e.originalEvent.targetTouches.length;
You can’t perform that action at this time.