Skip to content

Instantly share code, notes, and snippets.

View Teino1978-Corp's full-sized avatar

Teino Boswell Teino1978-Corp

  • Ocho Rios, Jamaica
View GitHub Profile
<?php
require 's3/bootstrap.php';
$url = 'ftp://ftp10.simba.ru/katalog/3315424.jpg';
//$r = Socket::getHeaders($url, $m);
//var_dump($r, $m);
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_MAXREDIRS, 3);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($c, CURLOPT_NOBODY, true);
@Teino1978-Corp
Teino1978-Corp / example.rb
Created December 11, 2015 07:52
Bulk update example in ActiveRecord Rails
new_values = { 10 => "test1", 20 => "test2" }
value = new_values.map { |product_id, value| "(#{product_id}, #{value})" }.join(",")
ActiveRecord::Base.connection.execute(%(
UPDATE products AS p SET value = v.value
FROM (values #{values}) AS v(id, value)
WHERE p.id = v.id
))
@Teino1978-Corp
Teino1978-Corp / blogpost.md
Created December 10, 2015 07:33
Spring Data Fowler blog post

The GA release of Spring Data release train Fowler marks the finishing line of 6 month of development. It's time to give you an impression of the content of this release and a brief overview about individual features. The major themes of the Fowler release train were performance improvements and enhanced Java 8 support that are mainly reflected in the Spring Data JPA and MongoDB modules but a lot of other ones have seen significant improvements, too.

The easiest way to upgrade to the Spring Data Fowler release train is by using Spring Boot and configuring the spring-data-releasetrain.version property to Fowler-RELEASE. If you're not using Spring Boot yet, add the Spring Data BOM to your <dependencyManagement /> section of your Maven POM.

General themes

Java 8 streams in repository methods

One of Java 8's great new features is the Stream API, which allows Java developers t

Tuning Your Grails Applications

Profiling

Server-side tools

  • Spring Insight
  • Profiler Plugin
  • Hibernate logging
  • P6Spy
  • Hibernate Statistics
@GrabResolver(name='asf-snapshots', root="https://repository.apache.org/content/repositories/snapshots")
@Grab(group="org.apache.geode", module = "gemfire-core", version = "1.0.0-incubating-SNAPSHOT")
import com.gemstone.gemfire.cache.client.ClientCacheFactory
import com.gemstone.gemfire.cache.client.ClientRegionShortcut
cache = new ClientCacheFactory()
.addPoolLocator("localhost", 10334)
.create();
@Teino1978-Corp
Teino1978-Corp / Ruby Metaprogramming Fun
Created December 9, 2015 01:18
Why it's hard to not use Ruby after using it
#!/usr/bin/env ruby
# This is a little something that shows off the beauty of Ruby's object model.
# OK, let's first have a module that contains a class. You might choose to
# instantate this class and then use the makemod method to return a module
# that was created on the fly using the symbol you passed in to the method.
module A
class Gen

Cyber Fast Track: Redundant Array of Independent Clouds

DARPA-RA-11-52 Cyber Fast Track
  • Principal Investigators:
@Teino1978-Corp
Teino1978-Corp / ruby.md
Created December 2, 2015 18:42
Ruby (2.0.0)
# user.rb
# ----------------------------------------------------------------------------------------
class User < ActiveRecord::Base
has_many :identities, dependent: :destroy, inverse_of: :user
has_many :projects, through: :user_projects, source: :project
has_many :oauth_contacts
has_many :wepay_payment_approvals, class_name: 'WepayPaymentApproval', foreign_key: :backer_id
has_many :projects_invested_in, through: :wepay_payment_approvals, source: :project
has_many :connections