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/ruby | |
require 'vips' | |
# $ ruby vips-overlay.rb [INPUT_FILE] [OUTPUT_FILE] [TEXT] | |
# $ ruby vips-overlay.rb [INPUT_FILE] [OUTPUT_FILE] [TEXT] [HEX_COLOR] | |
# $ ruby vips-overlay.rb vips-input.png vips-output.png "Your overlay text here" "#1c7cd8" | |
def hex_color_to_rgb_array(hex_color) | |
hex_color.match(/^#(..)(..)(..)$/)&.captures&.map(&:hex) | |
end |
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
-# form.html.haml | |
= simple_form_for @project do |f| | |
-# normal SimpleForm association | |
= f.association :company | |
-# new and improved "sticky" association | |
= f.sticky_association :company | |
= f.input :name | |
= f.submit |
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
/* | |
This custom JMK file hacks in some basic "Theme" support for this Alloy project | |
You can put .tss files under the app/styles/themes/ directory and they will be auto-injected | |
into the main app.tss file (at the end of the file) | |
It will also convert plain TSS style rules into "Custom Query Styles" so that the rules | |
in each theme file will only apply if that theme is "active" in the app. | |
http://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Styles_and_Themes-section-35621526_AlloyStylesandThemes-CustomQueryStyles |
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 photoDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, "photos"); | |
if(!photoDir.exists()) { | |
photoDir.createDirectory(); | |
} | |
function takePhoto(e) { | |
// https://github.com/appcelerator-modules/ti.imagefactory | |
var ImageFactory = require('ti.imagefactory'); | |
Ti.Media.showCamera({ |
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
# Convert an Integer to a "Packed" Binary Coded Decimal (BCD) formatted array of bytes | |
# http://en.wikipedia.org/wiki/Binary-coded_decimal | |
def int_to_bcd_bytes(int) | |
# BCD format takes each digit of an integer value and encodes it into a nibble (4 bits) | |
# It maintains the order of the original digits, so 15 would be 00010101 | |
# Since we're dealing with nibbles, we have to zero-pad-left if the number has an odd number of digits | |
# Decimal digit Binary | |
# 0 0000 | |
# 1 0001 | |
# 2 0010 |
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
DECLARE @view AS VARCHAR(255) ; | |
DECLARE ListOfViews CURSOR FOR | |
SELECT TABLE_SCHEMA + '.' +TABLE_NAME FROM INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_TYPE = 'VIEW' | |
AND OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'IsMsShipped') = 0 | |
ORDER BY TABLE_SCHEMA,TABLE_NAME |