Skip to content

Instantly share code, notes, and snippets.

View hophacker's full-sized avatar
💭
BEST OR SHIT

hophacker hophacker

💭
BEST OR SHIT
  • 苏州瑞立思科技有限公司
  • 苏州
View GitHub Profile
@hophacker
hophacker / cloudSettings
Last active December 26, 2019 04:46
vscode settings
{"lastUpload":"2019-12-26T04:46:23.045Z","extensionVersion":"v3.4.3"}
@hophacker
hophacker / sublime-text-3-setup.md
Created July 25, 2019 08:38 — forked from ijy/sublime-text-3-setup.md
My Sublime Text 3 setup.

Sublime Text 3 Setup

Install Package Control

Install Package Control for easy package management.

  1. Open the console with Ctrl+`
  2. Paste in the following:
@hophacker
hophacker / gist:7d11714d7b7aa5448c08772f11de9710
Created May 24, 2016 14:07 — forked from osipov/gist:c2a34884a647c29765ed
Install Scala and SBT using apt-get on Ubuntu 14.04 or any Debian derivative using apt-get
sudo apt-get remove scala-library scala
sudo wget www.scala-lang.org/files/archive/scala-2.10.4.deb
sudo dpkg -i scala-2.10.4.deb
sudo apt-get update
sudo apt-get install scala
wget http://scalasbt.artifactoryonline.com/scalasbt/sbt-native-packages/org/scala-sbt/sbt/0.12.4/sbt.deb
sudo dpkg -i sbt.deb
sudo apt-get update
sudo apt-get install sbt
@hophacker
hophacker / socket-cheatsheet.js
Created April 25, 2016 17:33 — forked from alexpchin/socket-cheatsheet.js
A quick cheatsheet for socket.io
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
@hophacker
hophacker / ReactImage.js
Created April 25, 2016 09:00
Responsively show images using qiniu's image service
import React, {Component, PropTypes} from 'react'
import _ from 'lodash'
import ReactDOM from 'react-dom'
function getRatio () {
const multi = ['414x736', '375x667'].indexOf(`${window.innerWidth}+${window.innerHeight}`) !== -1 ? 2 : 1
// iPhone6 || iPhone6p
return (window.devicePixelRatio || 1) * multi
}
@hophacker
hophacker / start_rails.sh
Last active April 11, 2016 17:16
command for starting rails server
#!/bin/bash -
set -o nounset # Treat unset variables as an error
port=3002
search=false
RAILS_ENV=${RAILS_ENV:-development}
while getopts p:e:rw:s opt
do
@hophacker
hophacker / nginx.conf
Created October 1, 2015 09:46 — forked from atma/nginx.conf
Nginx + nodejs + socket.io websockets
# Add to nginx.conf http section
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
@hophacker
hophacker / index.md
Last active August 29, 2015 14:23 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

hey.i-feng.org