Replace all logical or assignment A ||= B with A || (A = B)
([^\s]+) \|\|= (.*);
$1 || ($1 = $2);
l = "xfbhlqtlj".split('').collect {|c| c[0] - 97} | |
k = [6,1,8,0,3,3,9,8,8] | |
l = l.zip(k).collect do |p| | |
t = (p[0] - p[1]) % 26 | |
t += 97 | |
t.chr | |
end | |
p l.join('') |
gem: --no-rdoc --no-ri |
Replace all logical or assignment A ||= B with A || (A = B)
([^\s]+) \|\|= (.*);
$1 || ($1 = $2);
package | |
{ | |
import flash.display.Sprite; | |
import flash.events.Event; | |
/** | |
* 1. What will be printed to the console (via the trace statement)? | |
* 2. What is the value of this inside of nested() | |
*/ | |
public class Main extends Sprite |
Assignment in most other languages could be thought of as a stateful computation. For instance, when we do x = 5 in an imperative language, it will usually assign the value 5 to the variable x and it will also have the value 5 as an expression. If you look at that functionally, you could look at it as a function that takes a state (that is, all the variables that have been assigned previously) and returns a result (in this case 5) and a new state, which would be all the previous variable mappings plus the newly assigned variable.
A file with the extension .crt or .cer, contains a single X.509 certificate using
#!/bin/bash | |
# LC_CTYPE is for darwin | |
cat /dev/urandom | LC_CTYPE=C tr -cd 'a-f0-9' | head -c 32 |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
-- warp-2.1.5.2 | |
-- ghc -O2 -threaded -rtsopts warp | |
-- ./warp +RTS -N -A1G | |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Blaze.ByteString.Builder (copyByteString) | |
import Data.Text (unpack) | |
import Network.HTTP.Types.Status (status200) | |
import Network.Wai |
module Main where | |
class A a where | |
class B a where | |
foo :: (A a, B b) => IO a -> (a -> IO b) -> IO () | |
foo _ func = return () | |
where | |
-- this breaks because func is not passed in | |
barBroken :: (A a, B b) => a -> IO b |