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
FROM ruby:2.4.1-alpine | |
RUN apk --update --upgrade add build-base nodejs libxml2-dev libxslt-dev tzdata | |
RUN mkdir /app | |
WORKDIR /app | |
ADD Gemfile /app/Gemfile | |
ADD Gemfile.lock /app/Gemfile.lock | |
RUN bundle config --global build.nokogiri "--use-system-libraries" && bundle install --jobs 4 |
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
module Rescuable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def rescue_methods(*methods, from: nil, &block) | |
raise ArgumentError, 'Requires exception to rescue from' if from.blank? | |
from = [from] if !from.respond_to?(:any?) | |
methods.each do |method| | |
old_method = "_#{method}".to_sym |
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
module Weeks | |
def current_week | |
Date.today.strftime('%U').to_i | |
end | |
def weeks_this_year | |
Date.today_end_of_year.strftime('%U').to_i | |
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
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
import java.util.Properties; | |
public class Connector { | |
private static final String USERNAME = "username"; | |
private static final String PASSWORD = "password"; | |
private static final String HOST = "localhost"; | |
private static final short PORT = 3306; |
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
public class AccountAuthenticator extends AbstractAccountAuthenticator { | |
private final Context context; | |
@Inject @ClientId String clientId; | |
@Inject @ClientSecret String clientSecret; | |
@Inject ApiService apiService; | |
public AccountAuthenticator(Context context) { | |
super(context); |
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
/* | |
* Copyright 2014 Chris Banes | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { | |
menu = new MenuWrapper(menu) { | |
private MenuItem fix(MenuItem item) { | |
try { | |
Field f = item.getClass().getDeclaredField("mEmulateProviderVisibilityOverride"); | |
f.setAccessible(true); |
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
/* | |
* object.watch polyfill | |
* | |
* 2012-04-03 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ |
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 perl -w | |
print "WEBVTT\n\n"; | |
while(<>) { | |
s/(\d),(\d)/$1.$2/g if /--\>/; | |
s/^[ \t]+//; | |
s/[ \t]+$//; | |
s/\r\n$/\n/; |
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
var http = require('http'), | |
fileSystem = require('fs'), | |
path = require('path') | |
util = require('util'); | |
http.createServer(function(request, response) { | |
var filePath = 'path_to_file.mp3'; | |
var stat = fileSystem.statSync(filePath); | |
response.writeHead(200, { |
NewerOlder