Skip to content

Instantly share code, notes, and snippets.

=== cmwt Config Vars
APP_NAME: cmwt
BUNDLE_WITHOUT: development:test
COMMIT_HASH: be2f6dd
CONSOLE_AUTH: app771478:37de8d51938041bd8c8a7f006c704c47
DATABASE_URL: postgres://wybazhkijqfrco:YdJgQz426Epe30HQeekiYbBEMX@ec2-54-243-218-91.compute-1.amazonaws.com:5432/d45d3okb7cekfb
HEROKU_POSTGRESQL_BLACK_URL: postgres://wybazhkijqfrco:YdJgQz426Epe30HQeekiYbBEMX@ec2-54-243-218-91.compute-1.amazonaws.com:5432/d45d3okb7cekfb
HIREFIRE_EMAIL: [email protected]
HIREFIRE_PASSWORD: hkcxxxxxxxxx
LANG: en_US.UTF-8
(function(geo) {
if ( geo ) {
geo.watchPosition(function(location) {
console.log(location);
}); }
})(navigator.geolocation);
protected HttpURLConnection urlConnection(URL url)
{
HttpURLConnection c;
try
{
c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
c.setDoOutput(true);
c.connect();
}
public class CustomList2 extends ArrayAdapter<String>
{
public CustomList2(Context context, int layout_id, ArrayList<String> objects) {
super(context, layout_id, objects);
}
@Override
public View getView(final int position, View view, ViewGroup view_group) {
if(view == null)
{
THIS SERVERS HEADER DOESN'T WORK WITH urlConnection.getContentLength()
$ curl --head "http://www.server0.com/files-for-droid-app/vol-1-beginning-tango/02Posture_and_Walk.m4v"
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=A17762C6B65FD8D35840110F8628DE4B.V5; Path=/; HttpOnly
X-ServedBy: web114
Set-Cookie: SS_MID=7315b0cb-054c-4dd8-a013-c7163793becehfjcndg8; Domain=.tangoberretin.com; Expires=Thu, 13-Apr-2023 07:57:07 GMT; Path=/
Pragma: cache
Cache-Control: private,max-age=86400
Last-Modified: Thu, 21 Feb 2013 06:28:24 GMT
Map<String,List<String>> headers = urlConnection.getHeaderFields();
for (String key : headers.keySet()) {
Log.v("key", key + " : ");
for (String value : headers.get(key)) {
Log.v("value", value);
}
}
com.amazonaws.services.s3.transfer.Download download = tx.download(s3obj, new_video_file);
download.addProgressListener(new ProgressListener() {
public void progressChanged(ProgressEvent pe) {
String progress = download.getProgress().getPercentTransfered() + "%";
Log.v("dev", progress);
if (pe.isDone()) {
before_filter :current_user_to_AR
protected
def current_user_to_AR
cu = current_user
ActiveRecord::Base.send(:define_method, "current_user", proc {cu})
end
@benlieb
benlieb / deploy.rb
Last active December 20, 2015 07:49
require 'capistrano/ext/multistage'
require 'railsmachine/recipes'
set :application, "REMOVED"
set :domain, "REMOVED.org"
role :web, domain
role :app, domain, :primary => true
role :db, domain, :primary => true
>> Rails.cache.write('test', "foo", :expires_in => 1)
=> "foo"
>> #waiting 10 seconds
?> Rails.cache.read('test')
=> "foo"