Skip to content

Instantly share code, notes, and snippets.

View lianyi's full-sized avatar

lianyi lianyi

  • Bethesda MD
View GitHub Profile
@lianyi
lianyi / deploy-static-site-heroku.md
Created November 19, 2016 14:19 — forked from wh1tney/deploy-static-site-heroku.md
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@lianyi
lianyi / missing_indexes.sql
Created September 20, 2016 15:44 — forked from jasonmead/missing_indexes.sql
Find missing indexes in SQL Server
PRINT 'Missing Indexes: '
PRINT 'The "improvement_measure" column is an indicator of the (estimated) improvement that might '
PRINT 'be seen if the index was created. This is a unitless number, and has meaning only relative '
PRINT 'the same number for other indexes. The measure is a combination of the avg_total_user_cost, '
PRINT 'avg_user_impact, user_seeks, and user_scans columns in sys.dm_db_missing_index_group_stats.'
PRINT ''
PRINT '-- Missing Indexes --'
SELECT CONVERT (varchar, getdate(), 126) AS runtime,
mig.index_group_handle, mid.index_handle,
CONVERT (decimal (28,1), migs.avg_total_user_cost * migs.avg_user_impact * (migs.user_seeks + migs.user_scans)) AS improvement_measure,
1. Open /Applications/XAMPP/etc/httpd.conf
2. Enable the following Modules by removing the # at the front of the line.
- LoadModule rewrite_module modules/mod_rewrite.so
- LoadModule proxy_module modules/mod_proxy.so
- LoadModule proxy_http_module modules/mod_proxy_http.so
3. Copy and Paste below to the bottom of httpd.conf
# Implements a proxy/gateway for Apache.

Simplest way to add pan/zoom to a d3js visualisation

# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl
curl http://localhost:8983/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
curl http://localhost:8983/solr/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'
@lianyi
lianyi / app.js
Created May 10, 2016 14:31 — forked from rewonc/app.js
Authenticate a user with angularfire, save to firebase, and make available to controllers with promise
/*
This file is a brief example of how to use angularfire to authenticate a user, save that user's public profile to firebase, then
ensure that both the authenticated and public user are available in your controllers.
The route configuration uses angular-ui-router: https://github.com/angular-ui/ui-router
*/
@lianyi
lianyi / jquery.waituntilexists.js
Created April 30, 2016 16:52 — forked from PizzaBrandon/jquery.waituntilexists.js
Updated waitUntilExists plugin
;(function ($, window) {
var intervals = {};
var removeListener = function(selector) {
if (intervals[selector]) {
window.clearInterval(intervals[selector]);
intervals[selector] = null;
}
@lianyi
lianyi / geo_usstates.js
Last active April 11, 2016 18:32 — forked from mshafrir/states_hash.json
US states in JSON and JS format
var geo_usstates = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"id": "01",
"properties": {
"name": "AL"
},
"geometry": {
@lianyi
lianyi / Install passport-ldapauth
Last active October 17, 2017 18:26 — forked from smithkyle/Install passport-ldapauth
MEAN.js passport-ldapauth integration
npm install -S passport-ldapauth
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.TrueFileFilter;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.core.CoreContainer;