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
module Spree | |
module Piwik | |
class LineItem | |
include ActiveModel::Model | |
ATTRIBUTES = [:sku, :name, :price, :quantity, :categories] | |
attr_accessor(*ATTRIBUTES) | |
## | |
# Create a LineItem from a Spree::LinteItem-ish thing (line_items, |
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
server { | |
listen 80; | |
server_name example.com; | |
root /u/apps/examplecom/current/public; | |
passenger_enabled on; | |
passenger_app_env production; | |
try_files $uri @app; | |
location @app { |
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
############################################################# | |
################### OFFICIAL UBUNTU REPOS ################### | |
############################################################# | |
###### Ubuntu Main Repos | |
deb http://nl.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse | |
deb-src http://nl.archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse | |
###### Ubuntu Update Repos | |
deb http://nl.archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse |
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
#!/usr/bin/env ruby | |
require "sinatra" | |
include Math | |
# Anything but a space, number, .+-*/ or ^ is dissallowed | |
WHITELIST = %r{[^ 0-9.+\-*\/\^]+} | |
html = <<-EOT | |
<html> |
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
require "sqlite3" | |
hamster = SQLite3::Database.new ".local/share/hamster-applet/hamster.db" | |
timetrap = SQLite3::Database.new ".timetrap.db" | |
unparsed = hamster.execute("select * from facts inner join activities on activities.id = facts.activity_id inner join categories on categories.id = activities.category_id") | |
entries = unparsed.map do |e| | |
timetrap.execute("insert into entries (note, start, end, sheet) values (?, ?, ?, ?)", | |
"#{e[6]} #{e[4]}", |
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
<?php | |
$data = ""; | |
for ($i = 0; $i < 52000; $i++) { | |
$data .= "X"; | |
} | |
for ($i = 0; $i < 1000; $i++) { | |
$name = uniqid("siege-") . ".php"; | |
$fp = fopen($name, 'w'); | |
fwrite($fp, "<?php echo \"file {$i} {$name}\"; /** {$data} **/ ?>"); |
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
diff --git a/Performing-Backups.md b/Performing-Backups.md | |
index d5e1511..472e9a2 100644 | |
--- a/Performing-Backups.md | |
+++ b/Performing-Backups.md | |
@@ -191,6 +191,24 @@ The `backup perform` command will exit with the following status codes: | |
**2**: All triggers were _processed_, but some failed. | |
**3**: A fatal error caused Backup to exit. Some triggers may not have been processed. | |
+Passing Arbitrary Variables | |
+--------------------------- |
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
<?php | |
class View{ | |
var $attributes = array(); | |
var $object; | |
public function __construct($object) { | |
$this->object = $object; | |
$reflection = new ReflectionClass($object); | |
$props = $reflection->getProperties(ReflectionProperty::IS_PUBLIC); | |
foreach ($props as $prop) { |
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
require 'RMagick' | |
require 'smartcropper' | |
class DemoChopper | |
def initialize width, height, filename | |
@width, @height, @filename = width, height, filename | |
@files = [{ | |
image: ::Magick::ImageList.new(filename).resize_to_fit!(600, 1000), |
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
<?php | |
function foo($bar) { | |
var_dump($bar); | |
} | |
foo(array()); # => array(0) {} | |
## Works as expected. But now... | |
function foo(&$bar) { | |
var_dump($bar); |