Skip to content

Instantly share code, notes, and snippets.

View ldong's full-sized avatar
❤️
Love & Peace

Alan Dong ldong

❤️
Love & Peace
  • Sunnyvale, CA
View GitHub Profile
@ldong
ldong / discover_meteor_notes.md
Created February 21, 2017 06:52
Discover Meteor Notes

Discover Meteor

File Structure

/microscope /client /client/templates /client/stylesheets

/server

SELECT a.level_1 AS level_1, a.level_2 AS level_2, a.display_name AS display_name, c.full_segment_path AS taxo_path, a.targeting_id AS targeting_id, b.count AS count
FROM (SELECT * FROM pre_onboarding) a
LEFT OUTER JOIN (
    SELECT segment_id, COUNT(raw_id) AS count
    FROM yp_test_db.segment_gup
    WHERE country='23424747'
    GROUP BY segment_id) b
ON a.targeting_id=b.segment_id
LEFT OUTER JOIN (
// 获取沙盒主目录路径
NSString *homeDir = NSHomeDirectory();
// 获取Documents目录路径
NSString *docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
// 获取Library的目录路径
NSString *libDir = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
// 获取Caches目录路径
NSString *cachesDir = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject];
@ldong
ldong / javascript_online_questions.md
Last active February 5, 2017 21:57
javascript online questions

JavaScript Online Question

What is the outupt of the following snippet

function sum(a) {
  var sum = a;
  function f(b) {
    sum += b;
 return f;
@ldong
ldong / Redirect_non-www_to_www_AWS.md
Last active February 4, 2017 08:56
Redirect non-www to www on AWS EC2

Redirect non-www to www when using Bitnami Wordpress on AWS EC2

Solutions

vim /opt/bitnami/apps/wordpress/conf/htaccess.conf

Add these lines

#Force non-www:
RewriteEngine on
@ldong
ldong / one-liners.md
Created January 20, 2017 09:52 — forked from KL-7/one-liners.md
Ruby one-liners

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

<select placeholder="Select">
  <option
    ng-repeat="u in users"
    ng-if="u.name != user.name"
    value="{{u}}">{{u.name}}</option>
</select>

<select
 placeholder="Select"

JavaScript Namespace

/* Case 1 */
function changeMyName(data){
  data = { name: 'I guess I could?' }
}

var data = { name: 'Cannot Change My Name' };
console.log('Before', data);
@ldong
ldong / controllers.application.js
Created November 11, 2016 01:54
Push and Remove Objects
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
categories: [],
actions: {
addCategory(category) {
console.log('addCategory', arguments);
@ldong
ldong / controllers.application.js
Created November 8, 2016 08:01
property readOnly
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
data: function() {
return [1, 2, 3, 4, 5];
}.property().readOnly()
, actions: {