Skip to content

Instantly share code, notes, and snippets.

View Mithrandir0x's full-sized avatar

Oriol López Sánchez Mithrandir0x

View GitHub Profile
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@Mithrandir0x
Mithrandir0x / gist:4465421
Last active December 27, 2022 11:27
"Find HTML open tags" Regular Expression
// Found at http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454
//
// But beware, HTML cannot be regexed... The end is nigh.
var re = /<([a-z]+) *[^/]*?>/g;
@Mithrandir0x
Mithrandir0x / Made of Code.tmTheme
Created February 29, 2012 16:42
Theme "Made of Code" for SublimeText2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>mkdynamic</string>
<key>name</key>
<string>Made of Code</string>
<key>settings</key>
<array>
import cats.effect.{ContextShift, IO, Timer}
import fs2.concurrent.SignallingRef
import fs2.Stream
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.global
object ConcurrentlySnippet {
def enableSignal(signal: SignallingRef[IO, Boolean]): Stream[IO, Unit] =
@Mithrandir0x
Mithrandir0x / disable_wifi_hotspot.bat
Last active August 20, 2018 09:30
Two little batch files to create a cozy WiFi hotspot from the laptop Snatched from xda-developers, yet I don't remember the thread. Kudos to the author.
netsh wlan stop hostednetwork
pause
@Mithrandir0x
Mithrandir0x / fun.scala
Created March 6, 2018 08:24
Functed, Tupled and Curried
scala> def foo(x: Int, y: Double) = x * y
foo: (x: Int,y: Double)Double
scala> foo _
res0: (Int, Double) => Double = <function2>
scala> foo _ tupled
res1: ((Int, Double)) => Double = <function1>
scala> foo _ curried
@Mithrandir0x
Mithrandir0x / gist:3619682
Created September 4, 2012 10:22
"Example" style used in Bootstrap documentation.
.bs-docs-example
{
position: relative;
margin: 15px 0;
padding: 39px 19px 14px;
background-color: white;
border: 1px solid #DDD;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
[root@hbase scripts]# python yarn-utils.py -c 2 -m 16 -d 3 -k True
Using cores=2 memory=16GB disks=3 hbase=True
Profile: cores=2 memory=12288MB reserved=4GB usableMem=12GB disks=3
Num Container=4
Container Ram=3072MB
Used Ram=12GB
Unused Ram=4GB
yarn.scheduler.minimum-allocation-mb=3072
yarn.scheduler.maximum-allocation-mb=12288
yarn.nodemanager.resource.memory-mb=12288
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Mithrandir0x
Mithrandir0x / Main.java
Last active December 24, 2015 09:39
clientsocket
package clientsocket;
import java.io.*;
import java.net.Socket;
import java.util.Scanner;
/**
*
* @author manel
*/