View javascript.json
This file contains 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
{ | |
"Completeable named import": { | |
"prefix": ["nim"], | |
"body": ["import { ${2:value} } from \"${1:path}\";$0"], | |
"description": "A javascript named import statement that works with autocomplete by making you type the path statement first" | |
} | |
} |
View expand_sass_glob.rb
This file contains 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
## Given a glob pattern and a base directory expands that into a list of sass @import statements for files in that directory | |
glob = ARGV[0] | |
basedir = ARGV[0] | |
Dir.chdir(basedir) do | |
Dir[glob].each do |f| | |
puts "@import '#{f.gsub(/.scss$/, '')}';" | |
end |
View ClickBoundary.jsx
This file contains 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
// Author: Christian Schlensker for Bugsnag. | |
// @flow | |
import { omit } from 'lodash'; | |
import * as React from 'react'; | |
// Creates a React context to track track the tree of ClickBoundaries down the component hierarchy. | |
const NodeContext = React.createContext(); | |
type Props = { |
View rename.rb
This file contains 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
#!/usr/bin/env ruby | |
ROOT_PATH = File.dirname(__FILE__) + '/js/dashboard/' | |
COMPONENT_REGEX = /window\.(\w+) =.+(React|Reflux)/ | |
files = Dir.glob(ROOT_PATH + "**/*.{js,jsx,coffee,cjsx}") | |
# hard coded modules that we want to require. This list will be amended by searching for | |
# `window.X = (React|Redux)` definitions in the code base | |
components = [ | |
{name: 'UserActions', import_path: 'user_actions'}, | |
{name: 'UrlService', import_path: 'services/url_service'}, |
View bugsnag.js
This file contains 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
// The bugsnag javascript libraries are not isomorphic so we need to specify which one we want to use depending on environment. | |
let Bugsnag; | |
if (process.env.IS_BROWSER) { | |
Bugsnag = require('bugsnag-js'); | |
Bugsnag.apiKey = process.env.MY_BROWSER_PROJECT_API_KEY; | |
} else { | |
Bugsnag = require('bugsnag-node'); | |
Bugsnag.register(process.env.MY_NODE_PROJECT_API_KEY); | |
} |
View setup.js
This file contains 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
angular.module('myApp').config(['$httpProvider', function ($httpProvider) { | |
var interceptor = ['$q', function ($q) { | |
function success(response) { | |
return response; | |
} | |
function error(response) { | |
// Here we decide when and how to notify Bugsnag | |
if (response.status != 400) { // skip notification for form validation errors | |
Bugsnag.notify(response.statusText, response.config.url, {response: response}) |
View fix.diff
This file contains 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
[33m8fa668c[m -[31m (HEAD, origin/master, origin/HEAD, master)[m fix landing spec [32m(4 minutes ago) [1;34m<Christian Schlensker>[m | |
[1mdiff --git a/spec/features/landing_spec.rb b/spec/features/landing_spec.rb[m | |
[1mindex 13a5cc5..167cdae 100644[m | |
[1m--- a/spec/features/landing_spec.rb[m | |
[1m+++ b/spec/features/landing_spec.rb[m | |
[36m@@ -42,7 +42,7 @@[m [mdescribe 'Course Landing Pages', :js do[m | |
[m | |
within container do[m | |
fill_in :email, with: email[m | |
[31m- click_on button[m |
View sorting_hat.rb
This file contains 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
if student == :brave | |
puts "Griffindor!" | |
elsif student == :smart | |
puts "Ravenclaw!" | |
elsif student == :asshole | |
puts "Slytherin!" | |
else | |
puts "Shit... I don't know... Hufflepuff! ... I guess..." | |
end |
View stop_event.directive.js
This file contains 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
var angular = require('angular'); | |
// Simple directive that prevents an event from propagating to | |
// up the dom tree. | |
// | |
// ex: | |
// <div ng-click='doSomething()'> | |
// <a stop-event='click'>Some link</a> | |
// </div> | |
// |
View compass_convert.rb
This file contains 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
PROPS = %w{ | |
appearance | |
align-content | |
align-items | |
backface-visibility | |
background-size | |
border-radius | |
box-orient | |
box-shadow | |
box-sizing |
NewerOlder