Skip to content

Instantly share code, notes, and snippets.

@pavtaras
pavtaras / webpack.config.js
Created May 15, 2017 07:08
Webpack config for AngularJS apps
var webpack = require('webpack'),
path = require('path');
module.exports = function(env){
env = env || {};
var isProd = env.isProd || false;
var config = {
context: path.resolve("./src"),
entry: {
@jbarrus
jbarrus / gulpfile.js
Last active August 7, 2017 10:12
protractor coverage support with gulp and istanbul (not tested, this is just extracted from larger files to demonstrate how to get protractor coverage working)
var istanbul = require('istanbul'),
gulp = require('gulp'),
istanbul = require('gulp-istanbul');
gulp.task('js', function() {
return gulp.src('js')
.pipe(istanbul({
includeUntested: true,
coverageVariable: '__coverage__'
}))
@atrull
atrull / elite dangerous rare run notes
Last active August 29, 2015 14:12
elite dangerous rare run notes
rare run: from rares clustered to rares clustered in two runs each way - with a cobra mk3 and about 24-28 cargo slots.
based on clusters seen in this : https://www.elitedangeroustrader.co.uk/rares-systems-3d-map/
and a mid-point route from : https://cmdr.club/routes/
we need a cluster of rares to fill the ship
we need 150K or so LY between the clusters of rares.
@kavu
kavu / example.go
Created September 28, 2013 10:01
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
@excid3
excid3 / renderer.rb
Created August 28, 2013 22:31
Override ActionView::Renderer to inject view template/partial names into the HTML.
module ActionView
class Renderer
def render(context, options)
Rails.logger.info options.inspect
result = if options.key?(:partial)
render_partial(context, options)
else
render_template(context, options)
end
@postmodern
postmodern / rails_rce.rb
Last active July 17, 2023 11:54
Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#
# ## Advisory
#
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
#
# ## Caveats
#
@vojtajina
vojtajina / all-templates.html
Created August 15, 2012 00:00
AngularJS: load all templates in one file
<script type="text/ng-template" id="one.html">
<div>This is first template</div>
</script>
<script type="text/ng-template" id="two.html">
<div>This is second template</div>
</script>
anonymous
anonymous / decorator.rb
Created April 16, 2012 13:29
decorator - keeping it simple
class ThingDecorator < SimpleDelegator
def initialize(klass)
@model = klass
super(klass)
end
def class
@model.class
end
@jlebrech
jlebrech / run.sh
Created March 30, 2012 11:58
NGINX+RVM+UNICORN stack commands
echo precompile assets for production
rvmsudo RAILS_ENV=production bundle exec rake assets:precompile
echo restart unicorn
sudo kill `cat unicorn.pid`
echo start unicorn as production
rvmsudo unicorn_rails -c config/unicorn.rb -D --env production
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private