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
package com.username.ussd; | |
import android.app.Service; | |
import android.content.Intent; | |
import android.content.SharedPreferences; | |
import android.os.IBinder; | |
import android.os.RemoteException; | |
import android.preference.PreferenceManager; | |
import android.util.Log; | |
Angular directive code to help resize/redraw non-responsive elements (like D3 charts) in a bootstrap responsive design when the window moves across bootstrap boundaries.
(I edited my boostrap to create an extra size for some 7" tablets and landscape phones @ 600px)
What do you think? Good? Bad? Ugly? How could it be better? What other options exist?
Credit to tagtree for the Rickshaw directive help: http://tagtree.tv/d3-with-rickshaw-and-angular
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
angular.module('angularApp'). | |
directive('dt', function(){ | |
return { | |
require: '?ngModel', | |
restrict: 'A', | |
link: function ($scope, element, attrs, controller) { | |
var updateModel, onblur; | |
if (controller !== null) { |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
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
app.directive("clickToEdit", function() { | |
var editorTemplate = '<div class="click-to-edit">' + | |
'<div ng-hide="view.editorEnabled">' + | |
'{{value}} ' + | |
'<a ng-click="enableEditor()">Edit</a>' + | |
'</div>' + | |
'<div ng-show="view.editorEnabled">' + | |
'<input ng-model="view.editableValue">' + | |
'<a href="#" ng-click="save()">Save</a>' + | |
' or ' + |
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
window.onload = function () { | |
var objDiv = document.getElementById("idOfYourDiv"); | |
objDiv.scrollTop = objDiv.scrollHeight; | |
} |
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
//Based on http://www.samliew.com/icval/ | |
function validateNRIC(str) { | |
if (str.length != 9) | |
return false; | |
str = str.toUpperCase(); | |
var i, | |
icArray = []; | |
for(i = 0; i < 9; i++) { |
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
# Edit here - set path to you directory with config.json & fonts | |
FONT_DIR ?= ./assets/vendor/fontello/src | |
### Don't edit below ### | |
FONTELLO_HOST ?= https://fontello.com | |
fontopen: | |
@if test ! `which curl` ; then \ |