Skip to content

Instantly share code, notes, and snippets.

View lsongdev's full-sized avatar
👨‍💻

Lsong lsongdev

👨‍💻
View GitHub Profile
@lsongdev
lsongdev / ntfsutil.sh
Last active August 29, 2015 14:09 — forked from jsfaint/ntfsutil.sh
#!/bin/bash
mount_disk()
{
sudo umount $disk
mkdir ~/Desktop/$diskname
sudo mount_ntfs -o rw,auto,nodev,nobrowse,noowners,noatime $disk ~/Desktop/$diskname
echo "Mount $disk to ~/Desktop/$diskname"
open ~/Desktop/$diskname
}
{
"name": "weipai-downloader",
"version": "1.0.0",
"description": "",
"main": "weipai.js",
"author": "lsong",
"license": "MIT",
"dependencies": {
"async": "^0.9.0",
"download": "^3.1.2",
@lsongdev
lsongdev / MethodProfiler.js
Created December 17, 2014 05:22
MethodProfiler
var MethodProfiler = function(component) {
this.component = component;
this.timers = {};
this.log = document.createElement("ul");
var body = document.body;
document.getElementById("result").appendChild(this.log);
for(var key in this.component) {
// Ensure that the property is a function.
if(typeof this.component[key] !== 'function') {
continue;
/**
*
* Base64 encode / decode
* http://www.webtoolkit.info/
*
**/
var Base64 = {
// private property
@lsongdev
lsongdev / di.html
Last active August 29, 2015 14:12
Dependency injection Demo
<html>
<head>
<title>Dependency injection Demo</title>
<script charset="utf-8">
/**
* [依赖注入核心定义]
* @param {[type]} win [description]
* @param {[type]} undefined [description]
* @return {[type]} [description]
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define PI 3.14159265359
float sx, sy;
float sdCircle(float px, float py, float r) {
float dx = px - sx, dy = py - sy;
-- iMessage Spam报告自动化脚本 spamshot by ashfinal
(*
使用方法:
如果你需要扫描举报已有的垃圾信息(数量较多),请通过脚本编辑器直接运行该脚本(快捷键为⌘+R)。
如果想每当接收到垃圾信息时自动弹窗举报,请按照以下设置:
1. 打开Messages设置-General-AppleScript handler,下拉框选择"Open Scripts Folder";
2. 把该脚本扔到打开的Finder窗口,再到刚才的Messages设置里选择该脚本;
3. 到控制面板-隐私与安全-Privacy-Accessibility里面点加号手动添加iMessages.app的辅助控制权限;
app.factory 'CustomHttp', ($q)->
(originHttpPromise)->
deferred = $q.defer()
originHttpPromise
.success (data)->
deferred.resolve data
.error (err)->
deferred.reject err
deferred.promise
/**
* Created by solomon on 15/1/14.
*/
+function () {
angular.module('ui.router')
.provider('$otherwise', function ($urlRouterProvider) {
var url = '';
this.path = function (url) {
$urlRouterProvider.otherwise(function ($injector, $location) {
$('body>[ui-view]').html('');
<!DOCTYPE html>
<html>
<head>
<title>Maps</title>
<script src="http://maps.googleapis.com/maps/api/js"></script>
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function(){
var googleMap = document.getElementById("googleMap")
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){