Skip to content

Instantly share code, notes, and snippets.

View brianjlandau's full-sized avatar

Brian Landau brianjlandau

  • Walnut Creek, CA
View GitHub Profile
@brianjlandau
brianjlandau / share_on_change.js
Created August 25, 2015 22:20
Allows you to abstract out the common behaviour of wanting to create an onChange function that just sets the Colonel Kurtz value based on the input value.
/**
* SharedOnChange Colonel Kurtz Mixin
* Allows you to abstract out the common behaviour of wanting to
* create an onChange function that just sets the CK value
* based on the input value.
*/
var React = require('react')
module.exports = {
@brianjlandau
brianjlandau / gist:51395f332a93358fab10
Created August 26, 2015 23:18
One way to get a list of authors who worked on a specific directory and how many commits they contributed.
git log --pretty=%an your/path | awk -F, '{++freq[$1];}END{for (author in freq)printf "%s\t%d\n", author, freq[author];}'
@brianjlandau
brianjlandau / 0_reuse_code.js
Created February 7, 2014 16:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@brianjlandau
brianjlandau / javascript_resources.md
Created February 7, 2014 16:29 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@brianjlandau
brianjlandau / rails_resources.md
Created February 7, 2014 16:29 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
set daemon 120
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set mailserver localhost
set mail-format { from: monit-noreply@viget.com }
@brianjlandau
brianjlandau / secrets.rb
Created April 11, 2014 18:12
Secret ENV values for Heroku apps in dev
secrets_file = Rails.root.join('config', 'secrets.yml')
if secrets_file.file?
ENV.update(YAML.load_file(secrets_file)[Rails.env])
end
@brianjlandau
brianjlandau / gist:aa33f69932a4089a4de9
Created June 17, 2014 18:07
More strict web URL regex for validations. (better then URI.regexp)
require 'uri'
hostname = "(?:(?:[\\w\\-]+\\.)+[[:alpha:]]{2,})"
host = "(?:#{hostname}|#{URI::DEFAULT_PARSER.pattern[:IPV4ADDR]}|#{URI::DEFAULT_PARSER.pattern[:IPV6ADDR]})"
server = "//(?:#{URI::DEFAULT_PARSER.pattern[:USERINFO]}@)?#{host}(?::\\d*)?"
absolute_path = "(?:#{URI::DEFAULT_PARSER.pattern[:ABS_PATH]})?"
query = URI::DEFAULT_PARSER.pattern[:QUERY]
http_uri_regex = Regexp.new("\\A(?:http|https):(?:#{server}#{absolute_path})(?:\\?(?:#{query}))?\\z", Regexp::EXTENDED, 'N')
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
@brianjlandau
brianjlandau / send_imessage_repeatedly.scpt
Last active August 29, 2015 14:06
This sends an iMessage to the person who's phone number you enter 100 times every 5 seconds. Feel free to modify the delay or the number of times to repeat. Enjoy
repeat 100 times
tell application "Messages"
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy "3211234567" of targetService
send "This is an automated message" to targetBuddy
end tell
delay 5
end repeat