Skip to content

Instantly share code, notes, and snippets.

View aindong's full-sized avatar
🎯
Focusing

Alleo Indong aindong

🎯
Focusing
View GitHub Profile
@aindong
aindong / webpack.config.js
Last active December 10, 2015 12:12
multiple entry with babel loader webpack config
var path = require("path");
module.exports = {
entry: {
LoginBundle: "./public/src/login/index.js"
},
output: {
path: path.join(__dirname, "./"),
filename: "[name].js"
},
#!/usr/bin/env bash
if [ -z $1 ]
then
echo "serve www.domain.com /path"
exit 1
fi
if [ -z $2 ]
then
@aindong
aindong / foundation.reveal.react.js
Last active September 15, 2016 09:01
foundation.reveal.react.js
window.PainDiagramModal = React.createClass({
statics: {
open: function(){
this.$dialog = $('#diagramModal');
if (!this.$dialog.length) {
this.$dialog = $('<div id="diagramModal" class="reveal-modal" data-reveal role="dialog"></div>')
.appendTo('body');
}
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.ionicframework.minibalita361278" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/The
var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server);
var redis = require('redis');
server.listen(8890);
console.log('Socket server is now running on port: 8890');
io.on('connection', function (socket) {
console.log("new client connected");
@aindong
aindong / jqueryui.autocomplete.extension.js
Created June 3, 2015 02:13
Jquery UI autocomplete select extension
(function( $ ) {
$.ui.autocomplete.prototype.options.autoSelect = true;
$( ".ui-autocomplete-input" ).live( "blur", function( event ) {
var autocomplete = $( this ).data( "autocomplete" );
if ( !autocomplete.options.autoSelect || autocomplete.selectedItem ) { return; }
var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" );
autocomplete.widget().children( ".ui-menu-item" ).each(function() {
var item = $( this ).data( "item.autocomplete" );
@aindong
aindong / DynamicSetterGetter.php
Created April 16, 2015 15:47
Dynamic setter/getter using __call magic method of php
<?php
class Person
{
protected $firstName;
protected $lastName;
/**
* Magic method call for setter and getter
*
* @param $methodName
@aindong
aindong / toggleFullScreen.js
Last active August 29, 2015 14:17
Toggle Fullscreen mode on a webpage
function toggleFullScreen() {
if ((document.fullScreenElement && document.fullScreenElement !== null) ||
(!document.mozFullScreen && !document.webkitIsFullScreen)) {
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
@aindong
aindong / fix
Created March 17, 2015 13:24
Fixed a partitioned(shrinked) in size USB
The command line procedure is not simple, but it is the most likely thing to work.
When re-formatting the "drive" you're actually only formatting a partition on the drive. You need to use the diskpart utility to remove the partitions and create 1 single partition covering the full volume.
diskpart can be a bit dangerous, because if you pick the wrong disk or partition, you can remove data or partitions that are extremely, EXTREMELY important and lose all data on your machine.
Proceed with extreme caution!
Open up a command prompt as administrator (open the start menu, type cmd and press Enter.)
@aindong
aindong / recursiveRequest.js
Last active August 29, 2015 14:16
Recursive ajax request (polling)
var checkForNewReading = function () {
$.ajax({
url: location.href + '/request',
type: 'GEt',
dataType: 'json',
success: function(data) {
if (data) {
// DO SOMETHING
}
checkForNewReading();