Skip to content

Instantly share code, notes, and snippets.

View lovelock's full-sized avatar
🏠
Working from home

Frost Wong lovelock

🏠
Working from home
  • http://www.weibo.com
  • Beijing, China
View GitHub Profile
@lovelock
lovelock / config
Created January 26, 2015 08:41
svn config snippet
[helpers]
diff-cmd = /home/wangqingchun/tools/svndiff.sh
@lovelock
lovelock / config.json
Created March 4, 2015 08:38
composer config for China mainland users
{
"config": {},
"repositories": [
{
"type": "composer",
"url": "http://pkg.phpcomposer.com/repo/packagist/"
},
{
"packagist": false
}
@lovelock
lovelock / asoundrc
Created March 13, 2015 16:49
make my clevo laptop sing
pcm.!default {
type hw
card 1
device 2
}
ctl.!default {
type hw
card 1
}
@lovelock
lovelock / imagePickerControllerDidCancel.swift
Created November 20, 2015 11:39
Why do I need to call this block of code when Cancel of imagePickerController is tapped?
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
dismissViewControllerAnimated(true, completion: nil)
}
@lovelock
lovelock / relative_path_calculator.php
Created March 22, 2016 14:12
PHP version of relative_path_calculator
<?php
$path1 = 'a/b/c/d/e.png';
$path2 = 'a/b/f/g.png';
function pathfinder($path1, $path2)
{
$exploded_path1 = explode(DIRECTORY_SEPARATOR, $path1);
$exploded_path2 = explode(DIRECTORY_SEPARATOR, $path2);
@lovelock
lovelock / PHP.sublime-build
Created March 22, 2016 14:21
Sublime build system for PHP
{
"cmd": ["/usr/local/bin/php", "$file"],
"file_regex": "php$",
"selector": "source.php"
}
@lovelock
lovelock / testPrivateOrProtectedMethod.php
Created April 28, 2016 05:20
method to test private or protected methods of class
<?php
class PseudoUserTest extends PHPUnit_Framework_TestCase
{
public function invokeMethod(&$object, $methodName, $parameters = array())
{
$reflection = new ReflectionClass(get_class($object));
$method = $reflection->getMethod($methodName);
$method->setAccessible(true);
@lovelock
lovelock / maketag.sh
Created May 15, 2016 04:37
script to generate tag for git commit & integrate
#!/bin/sh
DATETIME=$(date +%Y%m%d_%H%M)
COMMITOR=$(whoami)
MESSAGE=$1
echo $DATETIME\_$COMMITOR_\$MESSAGE
@lovelock
lovelock / yaf.conf
Last active August 8, 2016 11:53
Yaf nginx configuration
server {
listen 80;
root /var/www/yaf.dev/public;
index index.php index.html index.htm;
server_name yaf.dev www.yaf.dev;
if (!-e $request_filename) {
@lovelock
lovelock / settings.xml
Created August 27, 2016 14:46
修改eclipse中的maven默认使用的JRE版本
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>