Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Landau brianjlandau

View GitHub Profile
@brianjlandau
brianjlandau / share_on_change.js
Created Aug 25, 2015
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.
View share_on_change.js
/**
* 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 Aug 26, 2015
One way to get a list of authors who worked on a specific directory and how many commits they contributed.
View gist:51395f332a93358fab10
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 / javascript_resources.md
Created Feb 7, 2014 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.
View javascript_resources.md

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 Feb 7, 2014 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.
View rails_resources.md

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
@brianjlandau
brianjlandau / 0_reuse_code.js
Created Feb 7, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View monitrc
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 Apr 11, 2014
Secret ENV values for Heroku apps in dev
View secrets.rb
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 Jun 17, 2014
More strict web URL regex for validations. (better then URI.regexp)
View gist:aa33f69932a4089a4de9
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')
View .ssh_config
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
@brianjlandau
brianjlandau / send_imessage_repeatedly.scpt
Last active Aug 29, 2015
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
View send_imessage_repeatedly.scpt
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
You can’t perform that action at this time.