Skip to content

Instantly share code, notes, and snippets.

@geowa4
geowa4 / SimpleApp.scala
Last active June 16, 2016 12:39
Testing Spark SQL with Postgres data source
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
import org.apache.spark.sql.SQLContext
object SimpleApp {
def main(args: Array[String]) {
val conf = new SparkConf().setAppName("Simple Application")
val sc = new SparkContext(conf)
val sqlContext = new SQLContext(sc)
@mmadden
mmadden / ember-file-org.md
Last active January 1, 2016 13:59
@wagenet asked for details on how I like files to be organized in Ember applications.
app/
  app.js
  application.hbs
  routing.js
  components/
    dropdown-button/
      dropdown-button.hbs
      DropdownButtonComponent.js
 google-map/
@Stanback
Stanback / nginx.conf
Last active February 4, 2022 18:05
Example Nginx configuration for serving pre-rendered HTML from Javascript pages/apps using the Prerender Service (https://github.com/collectiveip/prerender).Instead of using try_files (which can cause unnecessary overhead on busy servers), you could check $uri for specific file extensions and set $prerender appropriately.
# Note (November 2016):
# This config is rather outdated and left here for historical reasons, please refer to prerender.io for the latest setup information
# Serving static html to Googlebot is now considered bad practice as you should be using the escaped fragment crawling protocol
server {
listen 80;
listen [::]:80;
server_name yourserver.com;
root /path/to/your/htdocs;
@brendanstennett
brendanstennett / Guardfile
Last active December 19, 2015 06:38
Example Guardfile for using Zeus with RSpec
guard :rspec, cmd: 'zeus rspec --color' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.
@digitaljhelms
digitaljhelms / gist:5247192
Last active September 17, 2020 11:01
A faster, less buggy alternative to "python -m SimpleHTTPServer"
$ npm install -g http-server
$ http-server -p 8000 -a foo.bar.com

Would serve PWD at http://foo.bar.com/

@geopet
geopet / array.php
Created February 22, 2013 18:32
Quick example in elegance using PHP and Ruby. PHP forces us to use the bang to check for not. Ruby has `unless` which allows, in my opinion, a more fluid way to write code.
<?php
$my_array = array('apple', 'pear', 'cherry')
// If I want to find out if a value is in an array with PHP I do this:
if (in_array('apple', $my_array)) {
echo 'Apple is in the array!'; // => Apple is in the array!
}
@xxx
xxx / redis.yml
Created January 28, 2013 22:41
initialization of sidekiq, the hard way
defaults:
:port: 6379
:host: localhost
development:
:db: 2
:namespace: development
# force use of Redis::Distributed
:host:
- localhost
@cgallagher
cgallagher / milestone.rb
Created June 13, 2012 10:28
Active Admin Image Upload Form
ActiveAdmin.register Milestone do
scope :all, :default => true
scope :global
scope :user_specific
index do
column :title
column :description
column :required_litres
column :is_active
@paulrouget
paulrouget / .tmux.conf
Created January 27, 2012 17:37
Paul's configurations files
set -g default-terminal "screen-256color"
set -g status-utf8 on
bind M source-file ~/.tmux/mac.session
bind L source-file ~/.tmux/linux.session
# set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# THEME
set -g status-bg black