Skip to content

Instantly share code, notes, and snippets.

View jinwyp's full-sized avatar

Jin jinwyp

View GitHub Profile
@ideawu
ideawu / quicksort
Last active June 29, 2021 08:29
快速排序QuickSort算法JavaScript实现, 包括 Hoare 和 Lomuto 版本的实现,以及网友实现版本的对比
<html>
<body>
<script>
// @author: ideawu
// @link: http://www.ideawu.net/blog/archives/1021.html
var swap_count = 0;
var cmp_count = 0;
// https://gist.github.com/wintercn/c30464ed3732ee839c3eeed316d73253
function wintercn_qsort(arr, start, end){
@mmrko
mmrko / save-load-docker-images.sh
Last active January 30, 2023 10:23 — forked from lalyos/save-all-images.sh
Script to (selectively) save/load multiple Docker images
#!/usr/bin/env bash
# Script to (selectively) save/load multiple Docker images to/from a directory.
# Run ./save-load-docker-images.sh for help.
set -e
directory=$PWD
filter=""
compress=0
@jaredwilli
jaredwilli / todoCtrl.js
Created April 27, 2013 08:30
todoFactor and TodoCtrl modules for the angularFire TodoMVC example to show an alternative example for using angularFireCollection to sync data with a Firebase by using a Factory to do so. https://github.com/firebase/angularFire/issues/24
'use strict';
todomvc.controller('TodoCtrl', [ '$scope', 'todoFactory', 'filterFilter',
function OtherCtrl($scope, todoFactory, filterFilter) {
$scope.todos = todoFactory.getAllTodos('todos');
$scope.newTodo = '';
$scope.editedTodo = '';
$scope.addTodo = function() {
todoFactory.addTodo($scope.newTodo);
};
$scope.editTodo = function(todo) {
@Integralist
Integralist / regex.js
Created March 11, 2013 15:15
The difference between JavaScript's `exec` and `match` methods is subtle but important, and I always forget...
var str = "The quick brown fox jumped over the box like an ox with a sox in its mouth";
str.match(/\w(ox)/g); // ["fox", "box", "sox"]
// match (when used with a 'g' flag) returns an Array with all matches found
// if you don't use the 'g' flag then it acts the same as the 'exec' method.
str.match(/\w(ox)/); // ["fox", "ox"]
/\w(ox)/.exec(str); // ["fox", "ox"]
@JacksonTian
JacksonTian / uselesscode.md
Last active December 13, 2015 22:19
Node代码中最常见的几种废代码

三元表达式

var foo = bar === 'xxx' ? true : false;
// 更好的代码是:
var foo = bar === 'xxx';

两个和三个等号的判断,都是得到布尔值。

回调函数的传递

@yefuchs
yefuchs / gfw_contributors.md
Last active March 4, 2024 05:24
GFW Contributers

#The Great Firewall (GFW) Contributors List

注:数据来源为 dblp 和 cndblp, 下面括号中的数字表示 dblp 中显示的跟方滨兴合作论文的数量

###Binxing Fang (方滨兴)

中国工程院院士,北京邮电大学教授,中国科学院计算技术研究所网络方向首席科学家
http://en.wikipedia.org/wiki/Fang_Binxing

@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@panweizeng
panweizeng / gist:2489832
Created April 25, 2012 13:48
drawsomething
#!/usr/bin/env php
<?php
$all = 'abba
acdc
ace
acorn
add
adele
africa