This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# A hook script to verify that only syntactically valid ruby code is commited. | |
# Called by git-commit with no arguments. The hook should | |
# exit with non-zero status after issuing an appropriate message if | |
# it wants to stop the commit. | |
# | |
# Put this code into a file called "pre-commit" inside your .git/hooks | |
# directory, and make sure it is executable ("chmod +x .git/hooks/pre-commit") | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An example of using ngram analysis in ElasticSearch with the Tire rubygem | |
# ========================================================================== | |
# The original, raw example: https://gist.github.com/988923 | |
require 'rubygems' | |
require 'tire' | |
require 'yajl/json_gem' | |
class URL | |
def initialize(attributes={}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ======================================== | |
# Testing n-gram analysis in ElasticSearch | |
# ======================================== | |
curl -X DELETE localhost:9200/ngram_test | |
curl -X PUT localhost:9200/ngram_test -d ' | |
{ | |
"settings" : { | |
"index" : { | |
"analysis" : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class YourNamespace.Errors | |
window.onerror = (e) => @report(e) | |
@report: (e) -> | |
img = new Image(1,1) | |
img.src = '//' + your_config.errors_host + '/images/error_pixel.gif' | |
img.style.display='none' | |
document.getElementsByTagName('body')[0].appendChild(img); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
class Data_generator(object): | |
def __init__(self,K,d,reward_type='binary'): | |
self.d = d # dimension of the feature vector | |
self.K = K # number of bandits | |
self.reward_type = reward_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Improved dataset loader for Toxic Comment dataset from Kaggle | |
Tested against: | |
* Python 3.6 | |
* Numpy 1.14.0 | |
* Pandas 0.22.0 | |
* PyTorch 0.4.0a0+f83ca63 (should be very close to 0.3.0) | |
* torchtext 0.2.1 | |
* spacy 2.0.5 | |
* joblib 0.11 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Mac fix 1 - Install the Nokogiri gem on Mac OS 10.9 Mavericks | |
# | |
# Usage: to configure and install using Bundler, pass in 'bundle' as an argument to the script. | |
# | |
# Nokogiri works at a very low level, so it has many issues on various platforms. | |
# As a result, the command `install gem nokogiri` often will fail. This fix is for | |
# errors involving 'libiconv', such as the following one I encountered: | |
# |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function[binary_codes,G_vecs] = WTA_kernel_binary(X,G_vecs,G, K) | |
% G is number of permutation vectors | |
% K is the insterest span | |
if size(G_vecs,1) == 0 | |
G_vec = zeros(G,size(X,2)); | |
for i = 1:G | |
G_vecs(i,:) = randperm(size(X,2),size(X,2)); | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#chat-box.ubuntu.hidden-xs | |
.closed | |
.pull-right | |
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-chevron-up').html_safe, 'chat.show()' | |
.m-l-small | |
= link_to_function 'Chat with us', 'chat.show()' | |
.opened{style: 'display: none'} | |
.header | |
.pull-right | |
= link_to_function content_tag(:i, nil, class: 'glyphicon glyphicon-plus-sign').html_safe, 'chat.maximize()', class: 'maximize', style: 'display: none' |
OlderNewer