Skip to content

Instantly share code, notes, and snippets.

@dbankier
dbankier / gulpfile.js
Created Jul 6, 2015
Nativescript with Jade, SCSS and Babel
View gulpfile.js
// modified from this: https://github.com/emiloberg/nativescript-emulator-reload
// all sources
var babelSrc = [ 'src/**/*.js', '!src/tns_modules', '!src/tns_modules/**', '!src/node_modules', '!src/node_modules/**' ];
var jadeSrc = [ 'src/**/*.jade' ];
var sassSrc = [ 'src/**/*.scss' ];
var resources = [ 'src/{App_Resources,tns_modules,node_modules}/**', 'src/package.json'];
// Which emulator to run?
@dbankier
dbankier / word_generator
Last active Aug 29, 2015
Restricted Password List Generator
View word_generator

Basically, you forgot the password (for something, e.g. keystore) and need to generate a list of possible passwords to restrict the brute force possibilities.

For example you think it could be password, android or welcome, but could also be P@ssw0rd, aNdRoId! or Welcome1!.

Just modify the base_words (line 4) and suffixes (line 5) and run the script (you need node). It will output each possibility to the console. Or pipe it to a file.

./word_generator > words.txt
@dbankier
dbankier / gist:c0e15ff0babaa878112f
Created May 8, 2014
Add copyright/license note to the top of all js files
View gist:c0e15ff0babaa878112f
find . -type f | grep -v node_modules | grep -v modules | grep -v .git | grep -v .json | grep .js | xargs -I{} perl -pi -e 'print "/*\n * Copyright (c) 2011-2014 YY Digital Pty Ltd. All Rights Reserved.\n * Please see the LICENSE file included with this distribution for details.\n */\n\n" if $. == 1' {}
@dbankier
dbankier / Gruntfile.js
Last active Dec 20, 2015
Gruntfile for Alloy projects using jade and ltss This work in progress and likely to expand to include alloy commands, tishadow, xml2tss, etc, etc
View Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
jade: {
compile: {
options: {
pretty: true
},
files: [{
expand: true,
src: ['**/*.jade'],
@dbankier
dbankier / alloy.jmk
Created Jul 9, 2013
improved alloy.jmk for jade to support templates and includes
View alloy.jmk
task("pre:compile", function(event,logger) {
var wrench = require("wrench"),
fs = require("fs"),
jade = require("jade"),
view_root = event.dir.project,
path = require("path");
event.alloyConfig.xml = [];
wrench.readdirSyncRecursive(view_root).forEach(function(view) {
@dbankier
dbankier / alloy.jmk
Created May 25, 2013
alloy.jmk for automatic spy injection for TiShadow
View alloy.jmk
task("pre:compile", function(event,logger) {
var wrench = require("wrench"),
fs = require("fs"),
controllers_root = event.dir.controllers,
path = require("path");
if (event.alloyConfig.deployType === 'production') {
return;
}
@dbankier
dbankier / .vimrc
Last active Dec 14, 2015
Vim and TiAlloy: automatically open view and styles when opening controller (plus other styling)
View .vimrc
function OpenAlloy()
let s:view=substitute(expand('%:r'),"controllers","views","").".jade"
let s:style=substitute(expand('%:r'),"controllers","styles","").".tss"
exec '80vsp' s:style
set filetype=javascript
exec 'sp' s:view
set filetype=jade
endfunction
if has('autocmd')
@dbankier
dbankier / TiUIAlertDialogProxy.mm
Last active Mar 17, 2016
Adds `keyboardType` and `hintText` to PLAIN_TEXT_INPUT AlertDialog
View TiUIAlertDialogProxy.mm
// For SDK 3.0.0 modify TiUIAlertDialogProxy.m at around line 124 to look like this:
if ([TiUtils isIOS5OrGreater])
{
int style = [TiUtils intValue:[self valueForKey:@"style"] def:UIAlertViewStyleDefault];
[alert setAlertViewStyle:style];
if (style == UIAlertViewStylePlainTextInput) {
int keyboardType = [TiUtils intValue:[self valueForKey:@"keyboardType"] def: UIKeyboardTypeDefault];
NSString *hintText = [TiUtils stringValue:[self valueForKey:@"hintText"]];
UITextField *alertTextField = [alert textFieldAtIndex:0];