Skip to content

Instantly share code, notes, and snippets.

View khanghoang's full-sized avatar
😬

Khang Hoang khanghoang

😬
  • Dropbox
  • San Jose, CA
  • 10:45 (UTC -06:00)
  • X @khanght
View GitHub Profile
@andrashee
andrashee / .csslintrc
Last active August 29, 2015 14:02
Meteor JSHint / CSSLint Configuration
--exclude-list=.meteor/,packages/
@rishiag
rishiag / build.sh
Last active August 29, 2015 14:16
cd code-repo
git pull origin master
rm ~/build-dir/code-repo.tar.gz
meteor build ~/build-dir/
cd ~/build-dir
value=`cat fileCheck`
if [ "$value" = "old" ]; then
rm -rf ~/build-dir/new
mkdir ~/build-dir/new
tar xzvf code-repo.tar.gz -C ~/build-dir/new
@romaonthego
romaonthego / htmltest.m
Created September 23, 2013 16:08
UITextView with HTML text (iOS 7)
- (void)viewDidLoad
{
[super viewDidLoad];
UITextView *textView = [[UITextView alloc] init];
textView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:textView];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[textView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(textView)]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[textView]-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(textView)]];
NSString *htmlString = @"<h1>Header</h1><h2>Subheader</h2><p>Some <em>text</em></p><img src='http://blogs.babble.com/famecrawler/files/2010/11/mickey_mouse-1097.jpg' width=70 height=100 />";
@toan2406
toan2406 / mongodb-auth.txt
Last active October 20, 2016 09:57
MongoDB authentication setting
docker run -v /datadir:/data/db --name mongo -p 27017:27017 -d mongo --auth
docker exec -it mongo mongo
> use admin
> db.system.users.find()
> db.createUser({ user: 'admin', pwd: 'admin', roles: [ { role: "root", db: "admin" } ] });
> use some-db
> db.createUser({ user: 'user', pwd: 'user', roles: [ "readWrite" ] });
@anhnt
anhnt / Account.js
Created January 7, 2014 10:02
Passport authenticate with SailsJS (v0.98)
// api/models/Account.js
module.exports = {
attributes: {
acct_id: {
type: 'int',
primaryKey: true
},
loginName: {
type: 'string',
import express from 'express';
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import App from './components/App';
import {flushServerSideRequires} from 'react-loadable';
let app = express();
let webpackStats = require('./output-webpack-stats.json');
@ryansch
ryansch / README.md
Created July 23, 2016 22:24
neovim + yadr
@nebiros
nebiros / gist:9196645
Last active January 8, 2019 05:10
Send Push Notifications from node.js with Parse.com SDK
var Parse = require("parse").Parse;
Parse.initialize(
"", // applicationId
"", // javaScriptKey
"" // masterKey
);
var query = new Parse.Query(Parse.Installation)
, data = {
@swizzlr
swizzlr / blockdeclsyntax.md
Created August 19, 2013 13:11
Block Declaration Syntax List, originally by [pcperini](http://stackoverflow.com/a/9201774/929581), parsed to markdown for printing with your favourite CSS (I recommend @ttscoff's Marked)

List of Block Declaration Syntaxes

Throughout, let

  • return_type be the type of object/primitive/etc. you'd like to return (commonly void)
  • blockName be the variable name of the block you're creating
  • var_type be the type object/primitive/etc. you'd like to pass as an argument (leave blank for no parameters)
  • varName be the variable name of the given parameter And remember that you can create as many parameters as you'd like.

Blocks as Variables

Possibly the most common for of declaration.

@xmlking
xmlking / Enum.es6.js
Last active June 25, 2019 18:09
JavaScript Enums with ES6, Type Checking and Immutability
export class EnumSymbol {
sym = Symbol.for(name);
value: number;
description: string;
constructor(name: string, {value, description}) {
if(!Object.is(value, undefined)) this.value = value;
if(description) this.description = description;