Skip to content

Instantly share code, notes, and snippets.

@dbankier
dbankier / vscode_extensions.md
Created May 26, 2016 21:54
VS Code Extensions
@dbankier
dbankier / gulpfile.js
Created July 6, 2015 08:27
Nativescript with Jade, SCSS and Babel
// 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 August 29, 2015 14:23
Restricted Password List 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 13:27
Add copyright/license note to the top of all js files
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 December 20, 2015 05:09
Gruntfile for Alloy projects using jade and ltss This work in progress and likely to expand to include alloy commands, tishadow, xml2tss, etc, etc
module.exports = function(grunt) {
grunt.initConfig({
jade: {
compile: {
options: {
pretty: true
},
files: [{
expand: true,
src: ['**/*.jade'],
@dbankier
dbankier / alloy.jmk
Created July 9, 2013 06:33
improved alloy.jmk for jade to support templates and includes
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 12:45
alloy.jmk for automatic spy injection for TiShadow
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 December 14, 2015 08:49
Vim and TiAlloy: automatically open view and styles when opening controller (plus other styling)
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 March 17, 2016 06:12
Adds `keyboardType` and `hintText` to PLAIN_TEXT_INPUT AlertDialog
// 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];