Skip to content

Instantly share code, notes, and snippets.

View ronihcohen's full-sized avatar
🎯
Focusing

Rony HaCohen ronihcohen

🎯
Focusing
View GitHub Profile
@ronihcohen
ronihcohen / A-Pen-by-Ronny.markdown
Created January 30, 2014 14:51
A Pen by Ronny.
@ronihcohen
ronihcohen / gist:d2e07e0b2043845e6a94
Last active August 29, 2015 14:02
Ubuntu toggle HDMI display + sound output.
#!/bin/sh
# This shell script is PUBLIC DOMAIN. You may do whatever you want with it.
TOGGLE=$HOME/.toggle
if [ ! -e $TOGGLE ]; then
touch $TOGGLE
xrandr --output HDMI2 --auto --left-of VGA1
pactl set-card-profile 0 output:hdmi-stereo-extra2
else
@ronihcohen
ronihcohen / gist:64e80d617f791eb811e5
Created June 1, 2014 11:44
Quick guide div auto scroll
<style>
.guide-container{
height: 450px;
width: 750px;
overflow-x: scroll;
overflow-y: hidden;
direction: rtl;
}
@ronihcohen
ronihcohen / gist:1a55e2862e85116e90f6
Created June 21, 2014 13:09
Toggle default sound device - Windows 7 , autohotkey
ScrollLock::
switch := !switch
If (switch)
usePlaybackDevice(1)
else
usePlaybackDevice(4)
return
usePlaybackDevice(device) {
Run, mmsys.cpl
@ronihcohen
ronihcohen / Running "foreman" task
Last active August 29, 2015 14:02
Running "foreman" taskFatal error: spawn ENOENT
$ grunt --gruntfile /home/roni/web/the-shelf/Gruntfile.js serve
Running "clean:server" (clean) task
Cleaning .tmp...OK
Running "bowerInstall:app" (bowerInstall) task
Running "concurrent:server" (concurrent) task
Running "copy:styles" (copy) task
@ronihcohen
ronihcohen / gist:1241dcc6ab14351b6f41
Created July 13, 2014 12:48
angular-controller-as.html
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body ng-app="playground">
@ronihcohen
ronihcohen / gist:add2a0a05ad113c43c35
Created April 5, 2015 15:30
Angular google maps distance widget directive.
'use strict';
/**
* @ngdoc directive
* @name directive:distanceWidget
* @description
* # distanceWidget for angular-google-maps
*/
angular.module('app')
.directive('distanceWidget', function (uiGmapIsReady, $filter) {
var NorthEast = new google.maps.LatLng(
DefaultMapLocation.NorthEast.Latitude,
DefaultMapLocation.NorthEast.Longitude
);
var SouthWest = new google.maps.LatLng(
DefaultMapLocation.SouthWest.Latitude,
DefaultMapLocation.SouthWest.Longitude
);
var bounds = new google.maps.LatLngBounds();
@ronihcohen
ronihcohen / gist:42cacf51d391b0bbccd7
Created June 1, 2015 13:30
google maps distance widget
/**
* A distance widget that will display a circle that can be resized and will
* provide the radius in km.
*
* @param {google.maps.Map} map The map on which to attach the distance widget.
*
* @constructor
*/
function pairwise(arr, arg) {
var markerArr = [];
for (i=0;i<=arr.length-1;i++){
for (x=i+1;x<=arr.length-1;x++){
if ( !markerArr[x] && !markerArr[i]){
if (arr[x]+arr[i]==arg){
markerArr[x] = markerArr[i]= true;
}
}