Skip to content

Instantly share code, notes, and snippets.

View mosluce's full-sized avatar

mosluce mosluce

View GitHub Profile
@mosluce
mosluce / NSObject.swift
Last active March 1, 2020 11:51
超惰性 extension 大全 + 默司微調
//
// NSObject.swift
// QBDemo01
//
// Created by 默司 on 2016/12/2.
// Copyright © 2016年 默司. All rights reserved.
//
import Foundation
const express = require('express');
const mongodb = require('mongodb');
const app = express();
function to(promise) {
if (!(promise instanceof Promise)) {
promise = Promise.resolve(promise);
}
return promise.then(res => [null, res]).catch(err => [err]);
@mosluce
mosluce / ALL.js
Last active January 30, 2019 07:33 — forked from Hawksbillcat/ALL
$scope.get_romig_24g=function(){
return $scope.handle().then(function(res){
console.log("$scope.ip[0] "+ $scope.ip[0])
console.log("res "+res)
let url= "http://"+res+"/boafrm/formWlanRedirect?redirect-url=/wladvanced.htm&wlan_id=1"
return url
},function(err){
console.log(err)
err=err+"no ip"
return err
@mosluce
mosluce / withQuery.js
Created January 23, 2019 04:57
react-apollo Query hoc
import React from 'react';
import { Query } from "react-apollo";
import hoist from 'hoist-non-react-statics';
import compareProps from '../compareProps';
const withQuery = (query, { name, options = {}, mapPropKeys = [] }) => (WrappedComponent) => {
class WithQuery extends React.Component {
constructor() {
super();
#!/bin/bash
curl -sSL get.docker.com | sh -
git clone -b mujson https://github.com/mosluce/shadowsocksr
cd shadowsocksr
docker build -t ssr .
docker run -d --restart=always -p 6540-6550:6540-6550 --name ssr ssr
for (( i=1; i<=2; i++ ))
do
import React, { PureComponent } from "react";
import {
View,
TextInput,
TextInputProps,
ViewStyle,
TextStyle,
StyleProp,
Platform,
} from "react-native";
import React, { PureComponent } from "react";
import {
View,
Text,
TouchableWithoutFeedback,
Picker,
PickerItemProps,
Modal,
Animated,
TouchableWithoutFeedbackProps,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class LoadJson : MonoBehaviour
{
// Use this for initialization
IEnumerator Start()
public Circle(Vector3 center, Vector3 normal, int polyAmount, float radius)
{
this.normal = normal.normalized;
this.center = center;
var z = Vector3.forward;
var dot = Vector3.Dot(z, normal);
var y = z - dot * normal;
if (dot == 1 || dot == -1)
@mosluce
mosluce / install_ssr_server.sh
Last active May 2, 2018 01:09
ShadowsocksR 一鍵安裝 for Ubuntu Only
#!/bin/bash
apt-get update
apt-get install -y git-core
curl -sSL get.docker.com | sh -
git clone -b mujson https://github.com/mosluce/shadowsocksr.git
cd shadowsocksr