Skip to content

Instantly share code, notes, and snippets.

@pebosi
pebosi / alloy.js
Created December 10, 2015 09:00
testmap ti.map
// The contents of this file will be executed before any of
// your view controllers are ever executed, including the index.
// You have access to all functionality on the `Alloy` namespace.
//
// This is a great place to do any initialization for your app
// or create any global variables/functions that you'd like to
// make available throughout your app. You can easily make things
// accessible globally by attaching them to the `Alloy.Globals`
// object. For example:
//
@pebosi
pebosi / geo.js
Last active August 29, 2015 14:24
/*
Place this file in your /lib directory.
Require geo in calling module like var geo = require("geo"); Then call geo.init() at the start of your app.
To get current location, place a fireEvent at the start of your app and anywhere else location needs updating like this:
Ti.App.addEventListener('resume', function() {
Ti.App.fireEvent('getCurrentPosition');
});
@author Michael Stelly, et al.
@pebosi
pebosi / drupal7-reset-field-config.php
Created July 31, 2014 14:46
Drupal: Reset field_config type and module to field_set_storage after using mongo_db_migrate
/**
*
* When trying mongo_field_storage, and want to go back to old settings use this:
*
**/
function custom_field_config() {
$res = db_query("SELECT * FROM {field_config}");
$data = $res->fetchAll();
@pebosi
pebosi / preprent-line
Last active August 29, 2015 14:04
Prepend a line to a file
sed -i '1i Text for first line' /filename.csv
@pebosi
pebosi / Collatz.java
Created April 30, 2014 21:25
Collatz in Java
public class Collatz {
public static void main(String [] argv) {
int x = 100;
int z = 0;
while (x != 1) {
if (x % 2 == 0) {
x = x / 2;
}
@pebosi
pebosi / collatz
Last active August 20, 2021 07:14
Collatz in JavaScript
var x = 100, z = 0;
while (x != 1) {
if (x % 2 == 0) {
x = x / 2;
}
else {
x = x * 3 + 1;
}
z++;
}
@pebosi
pebosi / gist:9090062
Created February 19, 2014 11:15
Use parallel to mogrify images
find -iname "*.jpg" -type f -print0 | parallel --progress -0 -j +0 "mogrify -resize 800x800\> {}"