This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package nsqutils | |
| import ( | |
| "sync" | |
| "time" | |
| nsq "github.com/nsqio/go-nsq" | |
| ) | |
| // Producer is an interface that nsq.Producer fulfills |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component } from "React"; | |
| export var Enhance = ComposedComponent => class extends Component { | |
| constructor() { | |
| this.state = { data: null }; | |
| } | |
| componentDidMount() { | |
| this.setState({ data: 'Hello' }); | |
| } | |
| render() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################## | |
| ## Java | |
| ############################## | |
| .mtj.tmp/ | |
| *.class | |
| *.jar | |
| *.war | |
| *.ear | |
| *.nar | |
| hs_err_pid* |
To remove a submodule you need to:
- Delete the relevant section from the .gitmodules file.
- Stage the .gitmodules changes git add .gitmodules
- Delete the relevant section from .git/config.
- Run git rm --cached path_to_submodule (no trailing slash).
- Run rm -rf .git/modules/path_to_submodule (no trailing slash).
- Commit git commit -m "Removed submodule "
- Delete the now untracked submodule files rm -rf path_to_submodule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function dedent(callSite, ...args) { | |
| function format(str) { | |
| let size = -1; | |
| return str.replace(/\n(\s+)/g, (m, m1) => { | |
| if (size < 0) | |
| size = m1.replace(/\t/g, " ").length; |
This script for Google Spreadsheets allows you to generate slugs for your data such as might be used for creating unique urls.
Use it like this!
| # | A | B | C |
|---|---|---|---|
| 1 | a | b | slug |
| 2 | foo | baz bing | =slugify(A2:B4) |
| 3 | bar | BAZ | |
| 4 | FOO | baz-bing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $: (Dollar Colon) is basically a shorthand version of $LOAD_PATH. $: contains an array of paths that your script will search through when using require. | |
| $0 (Dollar Zero) contains the name of the ruby program being run. This is typically the script name. | |
| $* (Dollar Splat) is basically shorthand for ARGV. $* contains the command line arguments that were passed to the script. | |
| $? (Dollar Question Mark) returns the exit status of the last child process to finish. | |
| $$ (Dollar Dollar) returns the process number of the program currently being ran. | |
| $~ (Dollar Tilde) contains the MatchData from the previous successful pattern match. | |
| $1, $2, $3, $4 etc represent the content of the previous successful pattern match. | |
| $& (Dollar Ampersand) contains the matched string from the previous successful pattern match. | |
| $+ (Dollar Plus) contains the last match from the previous successful pattern match. | |
| $` (Dollar Backtick) contains the string before the actual matched string of the previous successful pattern match. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a simplified version of what we're using in production for drinksoma.com | |
| namespace :mosql do | |
| task :run => :environment do | |
| conf_path = Rails.root.join('config', 'collections.yml') | |
| cmd = "mosql -c #{conf_path} --sql #{ENV['MOSQL_POSTGRES_URI']} --mongo #{ENV['MOSQL_MONGO_URI']}" | |
| IO.popen(cmd) do |child| | |
| trap('TERM') { Process.kill 'INT', child.pid } | |
| $stdout.sync = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| For my own sanity ;) Scraped from a variety of places, including: http://stackoverflow.com/questions/14130560/nodejs-udp-multicast-how-to?utm_medium=twitter&utm_source=twitterfeed | |
| !Server | |
| var news = [ | |
| "Borussia Dortmund wins German championship", | |
| "Tornado warning for the Bay Area", | |
| "More rain for the weekend", | |
| "Android tablets take over the world", | |
| "iPad2 sold out", |